Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: fix bytes_may_use leak in do_remap_reloc_trans()

If the call to btrfs_reserve_extent() in do_remap_reloc_trans() returns
a smaller extent than we asked for, currently we're not undoing the
bytes_may_use change that we made. Fix this by calling
btrfs_space_info_update_bytes_may_use() again for the difference.

Fixes: fd6594b1446c ("btrfs: replace identity remaps with actual remaps when doing relocations")
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Mark Harmstone and committed by
David Sterba
9b882453 68a13501

+6
+6
fs/btrfs/relocation.c
··· 5006 5006 return ret; 5007 5007 } 5008 5008 5009 + if (ins.offset < remap_length) { 5010 + spin_lock(&sinfo->lock); 5011 + btrfs_space_info_update_bytes_may_use(sinfo, ins.offset - remap_length); 5012 + spin_unlock(&sinfo->lock); 5013 + } 5014 + 5009 5015 made_reservation = true; 5010 5016 5011 5017 new_addr = ins.objectid;