aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2013-09-28 22:33:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-20 10:45:12 -0500
commitfb5834ff2b2823e1eaecd920e2ade3e07f4a42f9 (patch)
treeaf2fc672caf897280b39d2eb1ad4a4f11704e2f7
parent2845c3628961c64e8e3fd6987234a818cfeadb35 (diff)
Btrfs: fix memory leak of chunks' extent map
commit 7d3d1744f8a7d62e4875bd69cc2192a939813880 upstream. As we're hold a ref on looking up the extent map, we need to drop the ref before returning to callers. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/btrfs/volumes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8bffb9174afb..b6c23c4abae2 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4248,6 +4248,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
4248 btrfs_emerg(fs_info, "Invalid mapping for %Lu-%Lu, got " 4248 btrfs_emerg(fs_info, "Invalid mapping for %Lu-%Lu, got "
4249 "%Lu-%Lu\n", logical, logical+len, em->start, 4249 "%Lu-%Lu\n", logical, logical+len, em->start,
4250 em->start + em->len); 4250 em->start + em->len);
4251 free_extent_map(em);
4251 return 1; 4252 return 1;
4252 } 4253 }
4253 4254
@@ -4429,6 +4430,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
4429 btrfs_crit(fs_info, "found a bad mapping, wanted %Lu, " 4430 btrfs_crit(fs_info, "found a bad mapping, wanted %Lu, "
4430 "found %Lu-%Lu\n", logical, em->start, 4431 "found %Lu-%Lu\n", logical, em->start,
4431 em->start + em->len); 4432 em->start + em->len);
4433 free_extent_map(em);
4432 return -EINVAL; 4434 return -EINVAL;
4433 } 4435 }
4434 4436