btrfs: replace the BUG_ON in btrfs_del_root_ref with proper error handling
authorQu Wenruo <wqu@suse.com>
Wed, 1 Dec 2021 11:56:17 +0000 (19:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Dec 2021 09:57:13 +0000 (10:57 +0100)
commit32d4054cb3e84202a8aee342a7e88c8674deeebd
tree25f1e87880a276acfe35ca95aaf0f7060927cdc1
parent477675049ca803aa95ff77468ffbddd966b415b0
btrfs: replace the BUG_ON in btrfs_del_root_ref with proper error handling

commit 8289ed9f93bef2762f9184e136d994734b16d997 upstream.

I hit the BUG_ON() with generic/475 test case, and to my surprise, all
callers of btrfs_del_root_ref() are already aborting transaction, thus
there is not need for such BUG_ON(), just go to @out label and caller
will properly handle the error.

CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/root-tree.c