Skip to content

Commit

Permalink
btrfs: handle errors returned from get_tree_block_key
Browse files Browse the repository at this point in the history
Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Zach Brown <zab@redhat.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
  • Loading branch information
David Sterba authored and Josef Bacik committed May 6, 2013
1 parent 48a3b63 commit 34c2b29
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fs/btrfs/relocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -2875,7 +2875,7 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
if (!path) {
err = -ENOMEM;
goto out_path;
goto out_free_blocks;
}

rb_node = rb_first(blocks);
Expand All @@ -2889,8 +2889,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
rb_node = rb_first(blocks);
while (rb_node) {
block = rb_entry(rb_node, struct tree_block, rb_node);
if (!block->key_ready)
get_tree_block_key(rc, block);
if (!block->key_ready) {
err = get_tree_block_key(rc, block);
if (err)
goto out_free_path;
}
rb_node = rb_next(rb_node);
}

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

out_free_path:
btrfs_free_path(path);
out_path:
out_free_blocks:
free_block_list(blocks);
return err;
}
Expand Down

0 comments on commit 34c2b29

Please sign in to comment.