]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: simplify error handling in btrfs_lookup_dentry
authorNikolay Borisov <nborisov@suse.com>
Thu, 14 Jul 2022 10:48:10 +0000 (13:48 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:45:42 +0000 (17:45 +0200)
commit1282ff90cd82f34e155ba5c53df0612007aeb368
tree1caf46ea2a0cb4e79f81ef979d26116072e41cfb
parentfcd3db4941af0e27f529466383a71c4bfc82abd5
btrfs: simplify error handling in btrfs_lookup_dentry

In btrfs_lookup_dentry releasing the reference of the sub_root and the
running orphan cleanup should only happen if the dentry found actually
represents a subvolume. This can only be true in the 'else' branch as
otherwise either fixup_tree_root_location returned an ENOENT error, in
which case sub_root wouldn't have been changed or if we got a different
errno this means btrfs_get_fs_root couldn't have executed successfully
again meaning sub_root will equal to root. So simplify all the branches
by moving the code into the 'else'.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c