diff options
| author | Boris Burkov <boris@bur.io> | 2026-05-11 13:07:11 -0700 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-05-16 03:07:17 +0200 |
| commit | 1e92637722ae4bd417f7a37e8d1485dc23b93935 (patch) | |
| tree | 52786f4b45bb065a921679fb86583a17d33ac256 /tools/testing/shared/xarray-shared.c | |
| parent | 975e63c7a8074d83e195577b7f76dadc9a3d14b7 (diff) | |
btrfs: check for subvolume before deleting squota qgroup
The invariant that we want to maintain with subvolume qgroups is that
the qgroup can only be deleted if there is no root. With squotas, we
thought that it was sufficient to just check the usage, because we
assumed that deleting a subvolume will drive it's qgroups usage to 0,
and thus 0 usage implies no subvolume.
However, this is false, for two reasons:
- A subvol whose extents are all from before squotas was enabled.
- A subvol that was created in this transaction and for which we have
not yet run any delayed refs.
In both cases, deleting the qgroup breaks the desired invariant and we
are left with a subvolume with no qgroup but squotas are enabled.
Fix this by unifying the deletion check logic between full qgroups and
squotas. Squotas do all the same checks *and* the additional usage == 0
check, which is the one extra rule peculiar to squotas.
Link: https://lore.kernel.org/linux-btrfs/adnBhWfJQ1n3hZC8@merlins.org/
Fixes: a8df35619948 ("btrfs: forbid deleting live subvol qgroup")
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 'tools/testing/shared/xarray-shared.c')
0 files changed, 0 insertions, 0 deletions
