diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2013-02-27 13:28:24 +0000 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-02-28 13:33:51 -0500 |
commit | 3321719ed67440bba1b0c5ae19c30d640263ccc8 (patch) | |
tree | 3da1957a0530eeef652efcbffea6709c2d46df09 /fs/btrfs/disk-io.c | |
parent | bdc20e67e82cfc4901d3a5a0d79104b0e2296d83 (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/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index eb7c14308521..5031e6dd5938 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3253,6 +3253,11 @@ void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root) if (btrfs_root_refs(&root->root_item) == 0) synchronize_srcu(&fs_info->subvol_srcu); + if (fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { + btrfs_free_log(NULL, root); + btrfs_free_log_root_tree(NULL, fs_info); + } + __btrfs_remove_free_space_cache(root->free_ino_pinned); __btrfs_remove_free_space_cache(root->free_ino_ctl); free_fs_root(root); |