summaryrefslogtreecommitdiffstats
path: root/fs/ext2/inode.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-10-09 00:00:47 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-10-09 00:00:47 +0000
commitd6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch)
treee2be02f33984c48ec019c654051d27964e42c441 /fs/ext2/inode.c
parent609d1e803baf519487233b765eb487f9ec227a18 (diff)
Merge with 2.3.19.
Diffstat (limited to 'fs/ext2/inode.c')
-rw-r--r--fs/ext2/inode.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 171f34a16..52e97c585 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -259,20 +259,22 @@ repeat:
}
if (metadata) {
result = getblk (inode->i_dev, tmp, blocksize);
+ memset(result->b_data, 0, blocksize);
+ mark_buffer_uptodate(result, 1);
+ mark_buffer_dirty(result, 1);
if (*p) {
ext2_free_blocks (inode, tmp, 1);
- brelse (result);
+ bforget (result);
goto repeat;
}
- memset(result->b_data, 0, blocksize);
- mark_buffer_uptodate(result, 1);
- mark_buffer_dirty(result, 1);
} else {
if (*p) {
/*
* Nobody is allowed to change block allocation
* state from under us:
*/
+ ext2_error (inode->i_sb, "block_getblk",
+ "data block filled under us");
BUG();
ext2_free_blocks (inode, tmp, 1);
goto repeat;
@@ -366,23 +368,29 @@ repeat:
goto out;
if (metadata) {
result = getblk (bh->b_dev, tmp, blocksize);
+ memset(result->b_data, 0, inode->i_sb->s_blocksize);
+ mark_buffer_uptodate(result, 1);
+ mark_buffer_dirty(result, 1);
if (*p) {
ext2_free_blocks (inode, tmp, 1);
- brelse (result);
+ bforget (result);
goto repeat;
}
- memset(result->b_data, 0, inode->i_sb->s_blocksize);
- mark_buffer_uptodate(result, 1);
- mark_buffer_dirty(result, 1);
} else {
+ if (*p) {
+ /*
+ * Nobody is allowed to change block allocation
+ * state from under us:
+ */
+ ext2_error (inode->i_sb, "block_getblk",
+ "data block filled under us");
+ BUG();
+ ext2_free_blocks (inode, tmp, 1);
+ goto repeat;
+ }
*phys = tmp;
*new = 1;
}
- if (*p) {
- ext2_free_blocks (inode, tmp, 1);
- brelse (result);
- goto repeat;
- }
*p = le32_to_cpu(tmp);
mark_buffer_dirty(bh, 1);
if (IS_SYNC(inode) || inode->u.ext2_i.i_osync) {
@@ -848,10 +856,11 @@ int ext2_notify_change(struct dentry *dentry, struct iattr *iattr)
unsigned int flags;
retval = -EPERM;
- if ((iattr->ia_attr_flags &
- (ATTR_FLAG_APPEND | ATTR_FLAG_IMMUTABLE)) ^
- (inode->u.ext2_i.i_flags &
- (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL))) {
+ if (iattr->ia_valid & ATTR_ATTR_FLAG &&
+ ((!(iattr->ia_attr_flags & ATTR_FLAG_APPEND) !=
+ !(inode->u.ext2_i.i_flags & EXT2_APPEND_FL)) ||
+ (!(iattr->ia_attr_flags & ATTR_FLAG_IMMUTABLE) !=
+ !(inode->u.ext2_i.i_flags & EXT2_IMMUTABLE_FL)))) {
if (!capable(CAP_LINUX_IMMUTABLE))
goto out;
} else if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))