ext2: Fix BUG_ON in evict() on inode deletion
authorJan Kara <jack@suse.cz>
Wed, 13 Mar 2013 11:57:08 +0000 (12:57 +0100)
committerJan Kara <jack@suse.cz>
Wed, 13 Mar 2013 14:23:44 +0000 (15:23 +0100)
commitc288d2969627be7ffc90904ac8c6aae0295fbf9f
treeb8d9b4cafa65bf7b0c915b850c42e3df80dd5434
parentaf591ad896ef75585752ac2eab4fba9437f23322
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>
fs/ext2/ialloc.c
fs/ext2/inode.c