Commit 0e9873e2 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

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: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
[ update changelog ]
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 45b87c5d
...@@ -1323,7 +1323,11 @@ int replace_path(struct btrfs_trans_handle *trans, struct reloc_control *rc, ...@@ -1323,7 +1323,11 @@ int replace_path(struct btrfs_trans_handle *trans, struct reloc_control *rc,
path->lowest_level = level; path->lowest_level = level;
ret = btrfs_search_slot(trans, src, &key, path, 0, 1); ret = btrfs_search_slot(trans, src, &key, path, 0, 1);
path->lowest_level = 0; path->lowest_level = 0;
BUG_ON(ret); if (ret) {
if (ret > 0)
ret = -ENOENT;
break;
}
/* /*
* Info qgroup to trace both subtrees. * Info qgroup to trace both subtrees.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment