]> Git Repo - linux.git/commitdiff
Btrfs: free all recorded tree blocks on error
authorLiu Bo <[email protected]>
Mon, 4 Mar 2013 16:25:38 +0000 (16:25 +0000)
committerJosef Bacik <[email protected]>
Mon, 4 Mar 2013 21:33:23 +0000 (16:33 -0500)
We've missed the 'free blocks' part on ENOMEM error.

Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
fs/btrfs/relocation.c

index 0f001c14eaf4498797a190958da1a90251b9fe46..7d1654cf9d485c873fa547b3819c9060b6e4795f 100644 (file)
@@ -2848,8 +2848,10 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
        int err = 0;
 
        path = btrfs_alloc_path();
-       if (!path)
-               return -ENOMEM;
+       if (!path) {
+               err = -ENOMEM;
+               goto out_path;
+       }
 
        rb_node = rb_first(blocks);
        while (rb_node) {
@@ -2888,10 +2890,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
                rb_node = rb_next(rb_node);
        }
 out:
-       free_block_list(blocks);
        err = finish_pending_nodes(trans, rc, path, err);
 
        btrfs_free_path(path);
+out_path:
+       free_block_list(blocks);
        return err;
 }
 
This page took 0.058622 seconds and 4 git commands to generate.