summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2018-01-25 11:02:53 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-02-22 15:42:30 +0100
commit1371798b92c84ddb06e0630fc1e2a9fcdeec2b57 (patch)
treed960d1463ea85016136d7f680cd18005c7eadb1e /fs
parent9a701c4fa563d3102b291de2531e0288ac4d7ee1 (diff)
Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly
commit e8f1bc1493855e32b7a2a019decc3c353d94daf6 upstream. This regression is introduced in commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction"). There are two problems, a) it is ->destroy_inode() that does the final free on inode, not ->evict_inode(), b) clear_inode() must be called before ->evict_inode() returns. This could end up hitting BUG_ON(inode->i_state != (I_FREEING | I_CLEAR)); in evict() because I_CLEAR is set in clear_inode(). Fixes: commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction") Cc: <stable@vger.kernel.org> # v4.7-rc6+ Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index db3f67b58104..dec7eea8aa29 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5318,7 +5318,7 @@ void btrfs_evict_inode(struct inode *inode)
trace_btrfs_inode_evict(inode);
if (!root) {
- kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
+ clear_inode(inode);
return;
}