Skip to content

Commit 320d8dc

Browse files
fdmananakdave
authored andcommitted
btrfs: fix bitmap leak when loading free space cache on duplicate entry
If we failed to link a free space entry because there's already a conflicting entry for the same offset, we free the free space entry but we don't free the associated bitmap that we had just allocated before. Fix that by freeing the bitmap before freeing the entry. Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent a394843 commit 320d8dc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/free-space-cache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
857857
spin_unlock(&ctl->tree_lock);
858858
btrfs_err(fs_info,
859859
"Duplicate entries in free space cache, dumping");
860+
kmem_cache_free(btrfs_free_space_bitmap_cachep, e->bitmap);
860861
kmem_cache_free(btrfs_free_space_cachep, e);
861862
goto free_cache;
862863
}

0 commit comments

Comments
 (0)