aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2013-02-27 08:28:24 -0500
committerJosef Bacik <jbacik@fusionio.com>2013-02-28 13:33:51 -0500
commit3321719ed67440bba1b0c5ae19c30d640263ccc8 (patch)
tree3da1957a0530eeef652efcbffea6709c2d46df09 /fs/btrfs/tree-log.c
parentbdc20e67e82cfc4901d3a5a0d79104b0e2296d83 (diff)
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>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index e8b7a68e1b37..8e85e0e4333d 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2466,8 +2466,10 @@ static void free_log_tree(struct btrfs_trans_handle *trans,
2466 .process_func = process_one_buffer 2466 .process_func = process_one_buffer
2467 }; 2467 };
2468 2468
2469 ret = walk_log_tree(trans, log, &wc); 2469 if (trans) {
2470 BUG_ON(ret); 2470 ret = walk_log_tree(trans, log, &wc);
2471 BUG_ON(ret);
2472 }
2471 2473
2472 while (1) { 2474 while (1) {
2473 ret = find_first_extent_bit(&log->dirty_log_pages, 2475 ret = find_first_extent_bit(&log->dirty_log_pages,