]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: fix bytes_may_use leak in move_existing_remap()
authorMark Harmstone <mark@harmstone.com>
Mon, 23 Mar 2026 12:59:47 +0000 (12:59 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 21 Apr 2026 02:00:32 +0000 (04:00 +0200)
commit68a135013bf73dfd6a277f76fc4e088b0f3dfa79
tree61c0a6b58177d218b0cb7d41d2aa2bb9e64d922b
parentfc3d53288158d68444eed059adb734709b855bbf
btrfs: fix bytes_may_use leak in move_existing_remap()

If the call to btrfs_reserve_extent() in move_existing_remap() 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: bbea42dfb91f ("btrfs: move existing remaps before relocating block group")
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c