Btrfs: don't return ino to ino cache if inode item removal fails
authorOmar Sandoval <osandov@fb.com>
Fri, 11 May 2018 20:13:35 +0000 (13:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:50:28 +0000 (07:50 +0200)
commitef61d940cd9684ebb910b12d4d0936c2ffc1f811
tree7c25c73dc26162cfa0e4bd2fee593fedf6b73ec1
parent9aecdc961e6a863866dcbc389b4d5324937a73ad
Btrfs: don't return ino to ino cache if inode item removal fails

[ Upstream commit c08db7d8d295a4f3a10faaca376de011afff7950 ]

In btrfs_evict_inode(), if btrfs_truncate_inode_items() fails, the inode
item will still be in the tree but we still return the ino to the ino
cache. That will blow up later when someone tries to allocate that ino,
so don't return it to the cache.

Fixes: 581bb050941b ("Btrfs: Cache free inode numbers in memory")
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/inode.c