]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix silent failure when deleting root reference
authorFilipe Manana <fdmanana@suse.com>
Mon, 22 Aug 2022 14:47:09 +0000 (15:47 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Aug 2022 20:15:21 +0000 (22:15 +0200)
commite12120226380e4055e5de24407a16301c90fc8e0
tree6871a9c89880e6f50bd43ea87d9b7ac566d4da10
parent1bd35ed937c20efe97b2fdc217c3ead4bf4e61fe
btrfs: fix silent failure when deleting root reference

At btrfs_del_root_ref(), if btrfs_search_slot() returns an error, we end
up returning from the function with a value of 0 (success). This happens
because the function returns the value stored in the variable 'err',
which is 0, while the error value we got from btrfs_search_slot() is
stored in the 'ret' variable.

So fix it by setting 'err' with the error value.

Fixes: c3e2821abd0a89 ("btrfs: replace the BUG_ON in btrfs_del_root_ref with proper error handling")
CC: stable@vger.kernel.org # 5.16+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/root-tree.c