diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2013-03-04 11:25:38 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-03-04 16:33:23 -0500 |
commit | e1a1267054ea9dcafd01636e52d441f809efad5e (patch) | |
tree | 81c66abefae5b7c65d30a9535c73425da3375fde /fs/btrfs/relocation.c | |
parent | aca1bba6f9bc550a33312b28e98b3de5ddb3bb15 (diff) |
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>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 0f001c14eaf4..7d1654cf9d48 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -2848,8 +2848,10 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans, | |||
2848 | int err = 0; | 2848 | int err = 0; |
2849 | 2849 | ||
2850 | path = btrfs_alloc_path(); | 2850 | path = btrfs_alloc_path(); |
2851 | if (!path) | 2851 | if (!path) { |
2852 | return -ENOMEM; | 2852 | err = -ENOMEM; |
2853 | goto out_path; | ||
2854 | } | ||
2853 | 2855 | ||
2854 | rb_node = rb_first(blocks); | 2856 | rb_node = rb_first(blocks); |
2855 | while (rb_node) { | 2857 | while (rb_node) { |
@@ -2888,10 +2890,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans, | |||
2888 | rb_node = rb_next(rb_node); | 2890 | rb_node = rb_next(rb_node); |
2889 | } | 2891 | } |
2890 | out: | 2892 | out: |
2891 | free_block_list(blocks); | ||
2892 | err = finish_pending_nodes(trans, rc, path, err); | 2893 | err = finish_pending_nodes(trans, rc, path, err); |
2893 | 2894 | ||
2894 | btrfs_free_path(path); | 2895 | btrfs_free_path(path); |
2896 | out_path: | ||
2897 | free_block_list(blocks); | ||
2895 | return err; | 2898 | return err; |
2896 | } | 2899 | } |
2897 | 2900 | ||