Commit 3e54f3a4 authored by Jan Kara's avatar Jan Kara Committed by Linus Torvalds

[PATCH] ext2 quota leak fix

Fix a subtle bug in error handling of ext2 xattrs.  When ext2_sync_inode()
fails because of ENOSPC (it could not write inode's dirty data) we want to
keep xattrs in a consistent state and release the old block properly.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2121b2ec
......@@ -706,8 +706,14 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
inode->i_ctime = CURRENT_TIME_SEC;
if (IS_SYNC(inode)) {
error = ext2_sync_inode (inode);
if (error)
/* In case sync failed due to ENOSPC the inode was actually
* written (only some dirty data were not) so we just proceed
* as if nothing happened and cleanup the unused block */
if (error && error != ENOSPC) {
if (new_bh && new_bh != old_bh)
DQUOT_FREE_BLOCK(inode, 1);
goto cleanup;
}
} else
mark_inode_dirty(inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment