Btrfs: fix memory leak of block group cache
authorLiu Bo <bo.li.liu@oracle.com>
Thu, 21 Jul 2016 00:44:12 +0000 (17:44 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Sep 2016 15:59:49 +0000 (17:59 +0200)
commitc79a175175d5a908a7c4d923d44f36808f56536e
treeb1eac23b00d931a0d6f5ebd72ba330096ddd6921
parent08895a8b6b06ed2323cd97a36ee40a116b3db8ed
Btrfs: fix memory leak of block group cache

While processing delayed refs, we may update block group's statistics
and attach it to cur_trans->dirty_bgs, and later writing dirty block
groups will process the list, which happens during
btrfs_commit_transaction().

For whatever reason, the transaction is aborted and dirty_bgs
is not processed in cleanup_transaction(), we end up with memory leak
of these dirty block group cache.

Since btrfs_start_dirty_block_groups() doesn't make it go to the commit
critical section, this also adds the cleanup work inside it.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent-tree.c