ext2: Fix BUG_ON in evict() on inode deletion
Commit 8e3dffc6
introduced a regression where deleting inode with
large extended attributes leads to triggering
BUG_ON(inode->i_state != (I_FREEING | I_CLEAR))
in fs/inode.c:evict(). That happens because freeing of xattr block
dirtied the inode and it happened after clear_inode() has been called.
Fix the issue by moving removal of xattr block into ext2_evict_inode()
before clear_inode() call close to a place where data blocks are
truncated. That is also more logical place and removes surprising
requirement that ext2_free_blocks() mustn't dirty the inode.
Reported-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
af591ad896
commit
c288d29696
2 changed files with 2 additions and 1 deletions
|
@ -118,7 +118,6 @@ void ext2_free_inode (struct inode * inode)
|
||||||
* as writing the quota to disk may need the lock as well.
|
* as writing the quota to disk may need the lock as well.
|
||||||
*/
|
*/
|
||||||
/* Quota is already initialized in iput() */
|
/* Quota is already initialized in iput() */
|
||||||
ext2_xattr_delete_inode(inode);
|
|
||||||
dquot_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
dquot_drop(inode);
|
dquot_drop(inode);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "ext2.h"
|
#include "ext2.h"
|
||||||
#include "acl.h"
|
#include "acl.h"
|
||||||
#include "xip.h"
|
#include "xip.h"
|
||||||
|
#include "xattr.h"
|
||||||
|
|
||||||
static int __ext2_write_inode(struct inode *inode, int do_sync);
|
static int __ext2_write_inode(struct inode *inode, int do_sync);
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ void ext2_evict_inode(struct inode * inode)
|
||||||
inode->i_size = 0;
|
inode->i_size = 0;
|
||||||
if (inode->i_blocks)
|
if (inode->i_blocks)
|
||||||
ext2_truncate_blocks(inode, 0);
|
ext2_truncate_blocks(inode, 0);
|
||||||
|
ext2_xattr_delete_inode(inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidate_inode_buffers(inode);
|
invalidate_inode_buffers(inode);
|
||||||
|
|
Loading…
Add table
Reference in a new issue