Btrfs: fix memory leaks after transaction is aborted
authorFilipe Manana <fdmanana@suse.com>
Fri, 27 Nov 2015 16:12:00 +0000 (16:12 +0000)
committerFilipe Manana <fdmanana@suse.com>
Thu, 17 Dec 2015 10:59:48 +0000 (10:59 +0000)
commit7785a663c4beebdafeb300caf2818e7e6474abd1
treefea9a8efe93a6cedb875f325b735be7ce053bcd1
parent50460e37186a2b932eacea24dca804bd1bcd2012
Btrfs: fix memory leaks after transaction is aborted

When a transaction is aborted, or its commit fails before writing the new
superblock and calling btrfs_finish_extent_commit(), we leak reference
counts on the block groups attached to the transaction's delete_bgs list,
because btrfs_finish_extent_commit() is never called for those two cases.
Fix this by dropping their references at btrfs_put_transaction(), which
is called when transactions are aborted (by making the transaction kthread
commit the transaction) or if their commits fail.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
fs/btrfs/transaction.c