]> git.hungrycats.org Git - linux/commit
Btrfs: fix memory leak of reloc_root
authorLiu Bo <bo.li.liu@oracle.com>
Tue, 19 Jul 2016 22:36:05 +0000 (15:36 -0700)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Thu, 28 Jul 2016 02:16:41 +0000 (22:16 -0400)
commite37bd2fa087ada9cc65d6e87df5453cddb06ab4b
tree412e761c5a403994255b006accf75456809205ea
parent1e50a062fc56b09bb623b963254f52d9444fa5b6
Btrfs: fix memory leak of reloc_root

When some critical errors occur and FS would be flipped into RO,
if we have an on-going balance, we can end up with a memory leak
of root->reloc_root since btrfs_drop_snapshots() bails out
without freeing reloc_root at the very early start.

However, we're not able to free reloc_root in btrfs_drop_snapshots()
because its caller, merge_reloc_roots(), still needs to access it to
cleanup reloc_root's rbtree.

This makes us free reloc_root when we're going to free fs/file roots.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
(cherry picked from commit 2eacc7e9dba0124fff766af5b5c9d12adab9fa74)
fs/btrfs/disk-io.c