Btrfs: fix memory leak of log roots

When we abort a transaction while fsyncing, we'll skip freeing log roots
part of committing a transaction, which leads to memory leak.

This adds a 'free log roots' in putting super when no more users hold
references on log roots, so it's safe and clean.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
Liu Bo
2013-02-27 13:28:24 +00:00
committed by Josef Bacik
parent bdc20e67e8
commit 3321719ed6
2 changed files with 9 additions and 2 deletions

View File

@@ -2466,8 +2466,10 @@ static void free_log_tree(struct btrfs_trans_handle *trans,
.process_func = process_one_buffer
};
ret = walk_log_tree(trans, log, &wc);
BUG_ON(ret);
if (trans) {
ret = walk_log_tree(trans, log, &wc);
BUG_ON(ret);
}
while (1) {
ret = find_first_extent_bit(&log->dirty_log_pages,