summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBoris Burkov <boris@bur.io>2026-05-11 13:06:24 -0700
committerDavid Sterba <dsterba@suse.com>2026-05-16 03:07:20 +0200
commit99aacd195141ff77295c535388888f072ec89e82 (patch)
treec89d0f78b43ede56e0b08d30ef1bb62e2c4a93a4 /include
parentd7c600554816b8ef70adffe078a0e360c055d82b (diff)
btrfs: clamp to avoid squota underflow
Simple quota accounting can undercount metadata tree block allocations in certain scenarios. When an undercounted subvolume is deleted and its tree blocks freed, the free deltas decrement rfer/excl past zero, wrapping the u64 to a value near U64_MAX. Once wrapped, can_delete_squota_qgroup() sees non-zero rfer and refuses to delete the qgroup. The qgroup becomes permanently orphaned in the quota tree, since there is no subvolume left to generate frees that would bring the counter back to zero. While we ultimately want to fix any mis-accounting at the source, it is also helpful and worthwhile to mitigate the damage by clamping rfer and excl to zero on underflow rather than allowing the u64 to wrap. This at least allows us to clean up the messed up qgroups on subvol deletion. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions