]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: do proper error handling in btrfs_update_reloc_root
authorJosef Bacik <josef@toxicpanda.com>
Fri, 12 Mar 2021 20:25:20 +0000 (15:25 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 May 2021 06:39:40 +0000 (08:39 +0200)
[ Upstream commit 592fbcd50c99b8adf999a2a54f9245caff333139 ]

We call btrfs_update_root in btrfs_update_reloc_root, which can fail for
all sorts of reasons, including IO errors.  Instead of panicing the box
lets return the error, now that all callers properly handle those
errors.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/relocation.c

index b445b3073dea1419c5e66784ba39246597fce286..e76097fb342c4e6fd1d9f8e38fce458edcbd07ab 100644 (file)
@@ -897,7 +897,7 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans,
        int ret;
 
        if (!have_reloc_root(root))
-               goto out;
+               return 0;
 
        reloc_root = root->reloc_root;
        root_item = &reloc_root->root_item;
@@ -930,10 +930,8 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans,
 
        ret = btrfs_update_root(trans, fs_info->tree_root,
                                &reloc_root->root_key, root_item);
-       BUG_ON(ret);
        btrfs_put_root(reloc_root);
-out:
-       return 0;
+       return ret;
 }
 
 /*