Commit 34c2b290 authored by David Sterba's avatar David Sterba Committed by Josef Bacik

btrfs: handle errors returned from get_tree_block_key

Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Reviewed-by: default avatarZach Brown <zab@redhat.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 48a3b636
...@@ -2875,7 +2875,7 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans, ...@@ -2875,7 +2875,7 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path(); path = btrfs_alloc_path();
if (!path) { if (!path) {
err = -ENOMEM; err = -ENOMEM;
goto out_path; goto out_free_blocks;
} }
rb_node = rb_first(blocks); rb_node = rb_first(blocks);
...@@ -2889,8 +2889,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans, ...@@ -2889,8 +2889,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
rb_node = rb_first(blocks); rb_node = rb_first(blocks);
while (rb_node) { while (rb_node) {
block = rb_entry(rb_node, struct tree_block, rb_node); block = rb_entry(rb_node, struct tree_block, rb_node);
if (!block->key_ready) if (!block->key_ready) {
get_tree_block_key(rc, block); err = get_tree_block_key(rc, block);
if (err)
goto out_free_path;
}
rb_node = rb_next(rb_node); rb_node = rb_next(rb_node);
} }
...@@ -2917,8 +2920,9 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans, ...@@ -2917,8 +2920,9 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
out: out:
err = finish_pending_nodes(trans, rc, path, err); err = finish_pending_nodes(trans, rc, path, err);
out_free_path:
btrfs_free_path(path); btrfs_free_path(path);
out_path: out_free_blocks:
free_block_list(blocks); free_block_list(blocks);
return err; return err;
} }
......
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