From: Boris Burkov <boris@bur.io>
To: Marc MERLIN <marc_btrfs@merlins.org>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Deleted snapshots stay in squota, mayube because of bees?
Date: Wed, 22 Apr 2026 12:38:53 -0700 [thread overview]
Message-ID: <20260422193853.GA1478152@zen.localdomain> (raw)
In-Reply-To: <aekh8CX_LmbtMbQ_@merlins.org>
On Wed, Apr 22, 2026 at 12:30:56PM -0700, Marc MERLIN wrote:
> On Wed, Apr 22, 2026 at 12:23:44PM -0700, Boris Burkov wrote:
> > > Is that still working as intended and I don't quite grasp how?
> >
> > We can't delete a qgroup that still has usage, and subvols own their
> > extents forever. So assuming no bugs, this means that some other
> > subvolume is referencing the extents originally owned by these
> > subvolumes. I agree that this sounds relatively unlikely for a failed
> > receive target you immediately deleted.
>
> Right, especially a read only snapshot (btrfs receive), which I 1000%
> know I did not re-snapshot again or re-share/re-use in any way.
> The only culprit I can find is bees whose job is indeed to link blocks
> across subvolumes.
> So maybe the way bees works, it make squota think the new subvolume
> is the main owner and when that that is deleted, it doesn't know (as
> per documentation) to re-assign those blocks to the older subvolume
> those blocks were shared with after bees linked them.
>
> > I believe that btrfs check has the ability to reconcile the on-disk
> > squota owner_refs with the on-disk qgroup values and find any real
> > discrepancies. So if you run that (without repair please :) ), and it
> > doesn't complain, I think you do have some legit sharing happening, and
> > you can try to track that down more directly.
>
> Assuming bees/beesd is to blame (the only reasonable culprit I can find,
> but then again it's doing its job), are you saying btrfs check can do
> a one time pass and re-assign block quotas to the remainin volume so
> they are not "lost" for squota?
No, I'm saying that there are two explanations for your observations:
1. You have legitimate shared extents owned by the deleted snapshot.
Presumably caused by bees as you guess.
2. A squotas bug where we have usage recorded for your qgroup but no
matching extent in the extent tree.
btrfs check will walk the extent tree and add up the extent usage based
on the squota owner refs and compare that to the value stored on the
qgroup. The squotas invariant is that those are equal. If it complains,
that means there is an extent attributed to a subvolume that isn't in
the qgroup number or there is some usage in the qgroup number that
doesn't have an appropriately tagged extent. The system is inconsistent.
That is all check will look for. If it complains about squotas on those
subvols, then you have hit the buggy case 2. If it doesn't, I would
strongly suspect case 1. At that point we would have to use different
tools to track down the shared extent, as squotas does not help with
that, really.
>
> Also, I understand the whole point of squota is not to take the huge
> amount of resources regular quota does, but is there a way (now, or
> planned) to do an expensive and occasional "re-assign/re-align" blocks
> to where they belong when squota lost track due to how it works? Is that
> the btrfs check you're referring to? (but then again btrfs check is read
> only, is it not?)
As currently designed, squotas is quite dogmatic about never re-owning
an extent from the original creator. That is the core design conceit and
simplification that allows it to be fast. There are likely narrow cases
where we could do efficient or on-demand re-owning but nothing like that
is currently planned. This would primarily serve the case where an
extent gets shared but the original owner is removed. In general, that
case is most accurately handled by traditional qgroups, but that can
cause performance problems on some workloads.
>
> Thanks,
> Marc
> --
> "A mouse is a device used to point at the xterm you want to type in" - A.S.R.
>
> Home page: http://marc.merlins.org/ | PGP 7F55D5F27AAF9D08
next prev parent reply other threads:[~2026-04-22 19:39 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-11 3:35 BTRFS discard crash: failed to run delayed ref for logical 15506102321152 num_bytes 16384 type 182 action 2 ref_mod 1: -2 6.11.2) Marc MERLIN
2026-04-11 4:47 ` Qu Wenruo
2026-04-11 12:04 ` Roman Mamedov
2026-04-11 16:22 ` Marc MERLIN
2026-04-12 1:57 ` Marc MERLIN
2026-04-12 1:57 ` Marc MERLIN
2026-04-12 2:28 ` Marc MERLIN
2026-04-12 2:28 ` Marc MERLIN
2026-04-12 17:38 ` Marc MERLIN
2026-04-12 17:38 ` Marc MERLIN
2026-04-12 20:21 ` Marc MERLIN
2026-04-12 20:21 ` Marc MERLIN
2026-04-13 2:14 ` Roman Mamedov
2026-04-13 2:34 ` Marc MERLIN
2026-04-13 2:34 ` Marc MERLIN
2026-04-13 17:52 ` Simple quota unsafe? RIP: 0010:__btrfs_free_extent.isra.0+0xc41/0x1020 [btrfs] / do_free_extent_accounting:2999: errno=-2 No such entry Marc MERLIN
2026-04-13 17:52 ` Marc MERLIN
2026-04-13 18:47 ` Boris Burkov
2026-04-13 19:40 ` Marc MERLIN
2026-04-13 19:40 ` Marc MERLIN
2026-04-15 5:21 ` Marc MERLIN
2026-04-15 17:05 ` Boris Burkov
2026-04-15 17:59 ` Marc MERLIN
2026-04-15 18:44 ` Boris Burkov
2026-04-15 20:22 ` Marc MERLIN
2026-04-15 22:36 ` Boris Burkov
2026-04-15 22:55 ` Marc MERLIN
2026-04-15 23:25 ` Boris Burkov
2026-04-16 0:55 ` Marc MERLIN
2026-04-16 1:22 ` Boris Burkov
2026-04-16 0:45 ` Boris Burkov
2026-04-16 1:08 ` Marc MERLIN
2026-04-16 1:25 ` Boris Burkov
2026-04-16 16:51 ` Simple quota unsafe (FIXED: btrfstune --remove-simple-quota worked) Marc MERLIN
2026-04-16 17:21 ` Simple quota unsafe? RIP: 0010:__btrfs_free_extent.isra.0+0xc41/0x1020 [btrfs] / do_free_extent_accounting:2999: errno=-2 No such entry Marc MERLIN
2026-04-16 21:36 ` Boris Burkov
2026-04-16 21:47 ` Marc MERLIN
2026-04-17 21:51 ` Boris Burkov
2026-04-17 22:37 ` Marc MERLIN
2026-04-17 23:16 ` Boris Burkov
2026-04-18 0:18 ` Marc MERLIN
2026-04-22 2:26 ` Boris Burkov
2026-04-22 6:08 ` Marc MERLIN
2026-04-22 17:10 ` Deleted snapshots stay in squota, mayube because of bees? Marc MERLIN
2026-04-22 19:23 ` Boris Burkov
2026-04-22 19:30 ` Marc MERLIN
2026-04-22 19:38 ` Boris Burkov [this message]
2026-04-22 20:11 ` Marc MERLIN
2026-04-23 19:28 ` Boris Burkov
2026-04-24 2:55 ` Marc MERLIN
2026-04-17 3:43 ` BTRFS discard crash: failed to run delayed ref for logical 15506102321152 num_bytes 16384 type 182 action 2 ref_mod 1: -2 6.11.2) David Disseldorp
2026-04-17 5:19 ` Marc MERLIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260422193853.GA1478152@zen.localdomain \
--to=boris@bur.io \
--cc=linux-btrfs@vger.kernel.org \
--cc=marc_btrfs@merlins.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox