From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: cem@kernel.org, stable@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 03/12] xfs: rescan the AGs if incore delalloc counter is negative
Date: Mon, 12 Oct 2026 09:14:11 -0700 [thread overview]
Message-ID: <20261012161411.GC2705364@frogsfrogsfrogs> (raw)
In-Reply-To: <aszdtdNDmnOSHSQT@infradead.org>
On Mon, Oct 12, 2026 at 06:16:37AM -0700, Christoph Hellwig wrote:
> On Sun, Oct 11, 2026 at 10:59:38PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > LOLLM complains that percpu_counter_sum can return a negative number but
> > we instead misinterpret that into a huge unsigned value and do bad
> > things to fdblocks. It shouldn't do that, so let's add a retry loop and
> > an attempt to freeze the filesystem to (hopefully) zero out the incore
> > delalloc counter. It probably won't work, but at least failing the
> > repair beats doing the wrong thing.
>
> I wonder how we could even end up with a negative value here, given
> that we should not see live changes. I.e. might it make more sense
> to just treat the theoretical negative values as 0 instead of a never
> exercises retry path?
I'm not sure how in practice you'd end up with a negative value in
the incore delalloc count. I changed it to try to freeze the filesystem
on the off chance that the summary counter corruption is mirrored in an
xfs_inode somewhere, and that purging them out will fix it. Or take
down the fs :P
But I could just bail entirely if the incore count is negative, since
in theory this situation Should Never Happen(tm):
delayed = percpu_counter_sum(&mp->m_delalloc_blks);
if (delayed < 0) {
ASSERT(delayed >= 0);
xchk_set_incomplete(sc);
return -EFSCORRUPTED;
}
Perhaps a better long term fix would be to sum the i_delayed_blks
counters across the entire xfs_inode cache and correct the incore
counter, but that sounds expensive for something that we shouldn't have
to worry about unless the CPU forgets arithmetic.
Oh hey, I should do the same for m_delalloc_rtextents. Let me go fix
that too.
--D
next prev parent reply other threads:[~2026-10-12 16:14 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 5:55 [PATCHSET 2/2] xfs: LLM-inspired bug fixes, part 23 Darrick J. Wong
2026-10-12 5:59 ` [PATCH 01/12] xfs: don't set a metadata directory's parent to sb_rootino Darrick J. Wong
2026-10-12 13:13 ` Christoph Hellwig
2026-10-12 5:59 ` [PATCH 02/12] xfs: don't rescan ifree and icount when frozen Darrick J. Wong
2026-10-12 13:13 ` Christoph Hellwig
2026-10-12 5:59 ` [PATCH 03/12] xfs: rescan the AGs if incore delalloc counter is negative Darrick J. Wong
2026-10-12 13:16 ` Christoph Hellwig
2026-10-12 16:14 ` Darrick J. Wong [this message]
2026-10-12 5:59 ` [PATCH 04/12] xfs: don't try to repair rtsummary if the summary file isn't computed Darrick J. Wong
2026-10-12 13:16 ` Christoph Hellwig
2026-10-12 6:00 ` [PATCH 05/12] xfs: update quota flags on secondary supers when metadir enabled Darrick J. Wong
2026-10-12 13:17 ` Christoph Hellwig
2026-10-12 16:30 ` Darrick J. Wong
2026-10-12 6:00 ` [PATCH 06/12] xfs: refactor directory data block walking loops in scrub Darrick J. Wong
2026-10-12 13:18 ` Christoph Hellwig
2026-10-12 6:00 ` [PATCH 07/12] xfs: improve dirent bounds checking in scrub and repair Darrick J. Wong
2026-10-12 13:18 ` Christoph Hellwig
2026-10-12 6:00 ` [PATCH 08/12] xfs: drop unnecessary sa parameter from the xrep_ag init functions Darrick J. Wong
2026-10-12 13:18 ` Christoph Hellwig
2026-10-12 6:01 ` [PATCH 09/12] xfs: drop unnecessary sr parameter from xrep_rtgroup " Darrick J. Wong
2026-10-12 13:19 ` Christoph Hellwig
2026-10-12 6:01 ` [PATCH 10/12] xfs: drop unnecessary sa parameter from xchk_ag " Darrick J. Wong
2026-10-12 13:19 ` Christoph Hellwig
2026-10-12 6:01 ` [PATCH 11/12] xfs: drop unnecessary sr parameter from xchk_rtgroup " Darrick J. Wong
2026-10-12 13:19 ` Christoph Hellwig
2026-10-12 6:01 ` [PATCH 12/12] xfs: refactor inode forkoff to byte conversions Darrick J. Wong
2026-10-12 13:19 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2026-10-13 6:05 [PATCHSET v2 2/2] xfs: LLM-inspired bug fixes, part 23 Darrick J. Wong
2026-10-13 6:09 ` [PATCH 03/12] xfs: rescan the AGs if incore delalloc counter is negative Darrick J. Wong
2026-10-13 11:48 ` Christoph Hellwig
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=20261012161411.GC2705364@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=stable@vger.kernel.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