diff options
author | Josef Bacik <jbacik@fb.com> | 2016-09-02 15:25:43 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-09-26 12:08:44 -0400 |
commit | 6bdf131fac2336adb1a628f992ba32384f653a55 (patch) | |
tree | 1fa2a56a821b5b40a704e535c8c37734a39354a2 | |
parent | e2c8990734874061d144184dbf0d66e2827c216f (diff) |
Btrfs: don't leak reloc root nodes on error
We don't track the reloc roots in any sort of normal way, so the only way the
root/commit_root nodes get free'd is if the relocation finishes successfully and
the reloc root is deleted. Fix this by free'ing them in free_reloc_roots.
Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/relocation.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 8e7c78ba77d9..3c0973a68572 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -2357,6 +2357,10 @@ void free_reloc_roots(struct list_head *list) | |||
2357 | while (!list_empty(list)) { | 2357 | while (!list_empty(list)) { |
2358 | reloc_root = list_entry(list->next, struct btrfs_root, | 2358 | reloc_root = list_entry(list->next, struct btrfs_root, |
2359 | root_list); | 2359 | root_list); |
2360 | free_extent_buffer(reloc_root->node); | ||
2361 | free_extent_buffer(reloc_root->commit_root); | ||
2362 | reloc_root->node = NULL; | ||
2363 | reloc_root->commit_root = NULL; | ||
2360 | __del_reloc_root(reloc_root); | 2364 | __del_reloc_root(reloc_root); |
2361 | } | 2365 | } |
2362 | } | 2366 | } |