From: Josef Bacik Date: Fri, 12 Mar 2021 20:25:23 +0000 (-0500) Subject: btrfs: handle btrfs_search_slot failure in replace_path X-Git-Tag: v5.13-rc1~159^2~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e9873e2fe43ea098e70c30c996ebb90a22cce43;p=thirdparty%2Fkernel%2Flinux.git btrfs: handle btrfs_search_slot failure in replace_path The search can fail for various reasons, in case of errors there's no cleanup to be done so we can pass the error to the caller, adjusting for the case where the key is not found and search slot returns 1. Reviewed-by: Qu Wenruo Signed-off-by: Josef Bacik Reviewed-by: David Sterba [ update changelog ] Signed-off-by: David Sterba --- diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index f1702157532a9..b62f5e46cf340 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1323,7 +1323,11 @@ again: path->lowest_level = level; ret = btrfs_search_slot(trans, src, &key, path, 0, 1); path->lowest_level = 0; - BUG_ON(ret); + if (ret) { + if (ret > 0) + ret = -ENOENT; + break; + } /* * Info qgroup to trace both subtrees.