diff options
author | Yan <yanzheng@21cn.com> | 2007-10-29 11:41:05 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:57 -0400 |
commit | c67cda1758130f3e437744c4c2ec4a7cc25564e3 (patch) | |
tree | 1bde8505d3652f857f02d16712df5294ee81e72f /fs/btrfs/extent_map.c | |
parent | 44ec0b7179b9bce7df1080370f51314a24a00216 (diff) |
Btrfs: Fix extent_map leak in extent_bmap
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r-- | fs/btrfs/extent_map.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index c44989a1e520..e4ee980cc138 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -1924,6 +1924,7 @@ sector_t extent_bmap(struct address_space *mapping, sector_t iblock, | |||
1924 | struct inode *inode = mapping->host; | 1924 | struct inode *inode = mapping->host; |
1925 | u64 start = iblock << inode->i_blkbits; | 1925 | u64 start = iblock << inode->i_blkbits; |
1926 | u64 end = start + (1 << inode->i_blkbits) - 1; | 1926 | u64 end = start + (1 << inode->i_blkbits) - 1; |
1927 | sector_t sector = 0; | ||
1927 | struct extent_map *em; | 1928 | struct extent_map *em; |
1928 | 1929 | ||
1929 | em = get_extent(inode, NULL, 0, start, end, 0); | 1930 | em = get_extent(inode, NULL, 0, start, end, 0); |
@@ -1932,9 +1933,12 @@ sector_t extent_bmap(struct address_space *mapping, sector_t iblock, | |||
1932 | 1933 | ||
1933 | if (em->block_start == EXTENT_MAP_INLINE || | 1934 | if (em->block_start == EXTENT_MAP_INLINE || |
1934 | em->block_start == EXTENT_MAP_HOLE) | 1935 | em->block_start == EXTENT_MAP_HOLE) |
1935 | return 0; | 1936 | goto out; |
1936 | 1937 | ||
1937 | return (em->block_start + start - em->start) >> inode->i_blkbits; | 1938 | sector = (em->block_start + start - em->start) >> inode->i_blkbits; |
1939 | out: | ||
1940 | free_extent_map(em); | ||
1941 | return sector; | ||
1938 | } | 1942 | } |
1939 | 1943 | ||
1940 | static int add_lru(struct extent_map_tree *tree, struct extent_buffer *eb) | 1944 | static int add_lru(struct extent_map_tree *tree, struct extent_buffer *eb) |