Skip to content

Commit 34c2b29

Browse files
kdaveJosef Bacik
authored andcommitted
btrfs: handle errors returned from get_tree_block_key
Signed-off-by: David Sterba <[email protected]> Reviewed-by: Zach Brown <[email protected]> Signed-off-by: Josef Bacik <[email protected]>
1 parent 48a3b63 commit 34c2b29

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/btrfs/relocation.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,7 +2875,7 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
28752875
path = btrfs_alloc_path();
28762876
if (!path) {
28772877
err = -ENOMEM;
2878-
goto out_path;
2878+
goto out_free_blocks;
28792879
}
28802880

28812881
rb_node = rb_first(blocks);
@@ -2889,8 +2889,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
28892889
rb_node = rb_first(blocks);
28902890
while (rb_node) {
28912891
block = rb_entry(rb_node, struct tree_block, rb_node);
2892-
if (!block->key_ready)
2893-
get_tree_block_key(rc, block);
2892+
if (!block->key_ready) {
2893+
err = get_tree_block_key(rc, block);
2894+
if (err)
2895+
goto out_free_path;
2896+
}
28942897
rb_node = rb_next(rb_node);
28952898
}
28962899

@@ -2917,8 +2920,9 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
29172920
out:
29182921
err = finish_pending_nodes(trans, rc, path, err);
29192922

2923+
out_free_path:
29202924
btrfs_free_path(path);
2921-
out_path:
2925+
out_free_blocks:
29222926
free_block_list(blocks);
29232927
return err;
29242928
}

0 commit comments

Comments
 (0)