From: Josef Bacik Date: Fri, 12 Mar 2021 20:25:20 +0000 (-0500) Subject: btrfs: do proper error handling in btrfs_update_reloc_root X-Git-Tag: accepted/tizen/unified/20230118.172025~7052^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=592fbcd50c99b8adf999a2a54f9245caff333139;p=platform%2Fkernel%2Flinux-rpi.git btrfs: do proper error handling in btrfs_update_reloc_root 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 Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index ca97412..489097f 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -903,7 +903,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; @@ -936,10 +936,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; } /*