Btrfs: free all recorded tree blocks on error
We've missed the 'free blocks' part on ENOMEM error. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
parent
aca1bba6f9
commit
e1a1267054
1 changed files with 6 additions and 3 deletions
|
@ -2848,8 +2848,10 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path)
|
if (!path) {
|
||||||
return -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
goto out_path;
|
||||||
|
}
|
||||||
|
|
||||||
rb_node = rb_first(blocks);
|
rb_node = rb_first(blocks);
|
||||||
while (rb_node) {
|
while (rb_node) {
|
||||||
|
@ -2888,10 +2890,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
|
||||||
rb_node = rb_next(rb_node);
|
rb_node = rb_next(rb_node);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
free_block_list(blocks);
|
|
||||||
err = finish_pending_nodes(trans, rc, path, err);
|
err = finish_pending_nodes(trans, rc, path, err);
|
||||||
|
|
||||||
btrfs_free_path(path);
|
btrfs_free_path(path);
|
||||||
|
out_path:
|
||||||
|
free_block_list(blocks);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue