After cloning root's node, we forgot to dec the src's ref which can lead to a memory leak.
Signed-off-by: Liu Bo <[email protected]> --- Jan, Please add this patch to your pull and notice Chris about it :) I didn't get this bug out since I didn't do rmmod yesterday... thanks, fs/btrfs/ctree.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index eba44b0..2afa585 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1261,16 +1261,19 @@ get_old_root(struct btrfs_root *root, u64 time_seq) tm = tree_mod_log_search(root->fs_info, logical, time_seq); if (old_root && tm && tm->op != MOD_LOG_KEY_REMOVE_WHILE_FREEING) { + struct extent_buffer *old; + btrfs_tree_read_unlock(root->node); free_extent_buffer(root->node); blocksize = btrfs_level_size(root, old_root->level); - eb = read_tree_block(root, logical, blocksize, 0); - if (!eb) { + old = read_tree_block(root, logical, blocksize, 0); + if (!old) { pr_warn("btrfs: failed to read tree block %llu from get_old_root\n", logical); WARN_ON(1); } else { - eb = btrfs_clone_extent_buffer(eb); + eb = btrfs_clone_extent_buffer(old); + free_extent_buffer(eb); } } else if (old_root) { btrfs_tree_read_unlock(root->node); -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
