From: "Darrick J. Wong" <djwong@kernel.org>
To: Carlos Maiolino <cem@kernel.org>
Cc: stable@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 06/12] xfs: only written file data blocks can be shared
Date: Wed, 14 Oct 2026 10:40:03 -0700 [thread overview]
Message-ID: <20261014174003.GI2705364@frogsfrogsfrogs> (raw)
In-Reply-To: <as83KAiPFgW0ZCSF@nidhogg.toxiclabs.cc>
On Wed, Oct 14, 2026 at 10:25:53AM +0200, Carlos Maiolino wrote:
> On Mon, Oct 12, 2026 at 11:06:46PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > LOLLM noticed that xchk_refcountbt_rmap_check (and its rt equivalent)
> > will count any rmap owner towards the shared count. However, the only
> > blocks that can be shared between xfs files are written file data
> > blocks; and the only blocks that can have single-refcount entries are
> > COW staging extents. Fix the checking code.
> >
> > Cc: <stable@vger.kernel.org> # v4.16
> > Fixes: dbde19da963706 ("xfs: cross-reference the rmapbt data with the refcountbt")
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > Assisted-by: LOLLM # finding obvious bugs
>
> This patch conflicts with Eric's:
>
> 1d55a102780 xfs: re-use refcount scrub/repair code for rtrefcount
>
> I'm just stripping off the rtrefcountbt part of this, the final result
> is here:
>
> commit 634b63baf05062988456a0bd5df2696c14ea2949
> Author: Darrick J. Wong <djwong@kernel.org>
> Date: Mon Oct 12 23:06:46 2026 -0700
>
> xfs: only written file data blocks can be shared
Yep, that looks good to me!
--D
>
>
> > ---
> > fs/xfs/scrub/refcount.c | 12 ++++++++++++
> > fs/xfs/scrub/rtrefcount.c | 12 ++++++++++++
> > 2 files changed, 24 insertions(+)
> >
> >
> > diff --git a/fs/xfs/scrub/refcount.c b/fs/xfs/scrub/refcount.c
> > index f8c51d8fbb3da5..a900d13c9e27c0 100644
> > --- a/fs/xfs/scrub/refcount.c
> > +++ b/fs/xfs/scrub/refcount.c
> > @@ -129,6 +129,18 @@ xchk_refcountbt_rmap_check(
> > return 0;
> > }
> >
> > + /*
> > + * The refcount btree should only have records for written file data
> > + * blocks or for COW staging blocks.
> > + */
> > + if ((XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) &&
> > + rec->rm_owner != XFS_RMAP_OWN_COW) ||
> > + (rec->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK |
> > + XFS_RMAP_UNWRITTEN))) {
> > + xchk_btree_xref_set_corrupt(refchk->sc, cur, 0);
> > + return 0;
> > + }
> > +
> > if (rec->rm_startblock <= refchk->bno && rm_last >= rc_last) {
> > /*
> > * The rmap overlaps the refcount record, so we can confirm
> > diff --git a/fs/xfs/scrub/rtrefcount.c b/fs/xfs/scrub/rtrefcount.c
> > index 3d916d71a135dc..00da8e98506d63 100644
> > --- a/fs/xfs/scrub/rtrefcount.c
> > +++ b/fs/xfs/scrub/rtrefcount.c
> > @@ -144,6 +144,18 @@ xchk_rtrefcountbt_rmap_check(
> > return 0;
> > }
> >
> > + /*
> > + * The refcount btree should only have records for written file data
> > + * blocks or for COW staging blocks.
> > + */
> > + if ((XFS_RMAP_NON_INODE_OWNER(rec->rm_owner) &&
> > + rec->rm_owner != XFS_RMAP_OWN_COW) ||
> > + (rec->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK |
> > + XFS_RMAP_UNWRITTEN))) {
> > + xchk_btree_xref_set_corrupt(refchk->sc, cur, 0);
> > + return 0;
> > + }
> > +
> > if (rec->rm_startblock <= refchk->bno && rm_last >= rc_last) {
> > /*
> > * The rmap overlaps the refcount record, so we can confirm
> >
> >
>
next prev parent reply other threads:[~2026-10-14 17:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 6:05 [PATCHSET v2 1/2] xfs: LLM-inspired bug fixes, part 22 Darrick J. Wong
2026-10-13 6:05 ` [PATCH 01/12] xfs: don't overrun incore inode when cleaning attr forks Darrick J. Wong
2026-10-13 6:05 ` [PATCH 02/12] xfs: fix data fork block count check in xrep_inode_blockcounts Darrick J. Wong
2026-10-13 6:06 ` [PATCH 04/12] xfs: reduce new btree slack factor if free space is negative Darrick J. Wong
2026-10-13 7:36 ` Christoph Hellwig
2026-10-13 6:06 ` [PATCH 05/12] xfs: don't queue rmap update twice when reaping a fork Darrick J. Wong
2026-10-13 6:06 ` [PATCH 06/12] xfs: only written file data blocks can be shared Darrick J. Wong
2026-10-13 11:47 ` Christoph Hellwig
2026-10-14 8:25 ` Carlos Maiolino
2026-10-14 17:40 ` Darrick J. Wong [this message]
2026-10-13 6:07 ` [PATCH 07/12] xfs: check for fragments when full-extent sharing matches Darrick J. Wong
2026-10-14 8:26 ` Carlos Maiolino
2026-10-14 17:40 ` Darrick J. Wong
2026-10-13 6:07 ` [PATCH 08/12] xfs: don't clear COWEXTSIZE on directories on reflink filesystems Darrick J. Wong
2026-10-13 6:07 ` [PATCH 09/12] xfs: clear set[ug]id mode bits when zapping attr fork Darrick J. Wong
2026-10-13 6:07 ` [PATCH 10/12] xfs: opportunistically skip btree block checks Darrick J. Wong
2026-10-13 7:36 ` Christoph Hellwig
2026-10-13 6:08 ` [PATCH 11/12] xfs: always report scrub errors in tracepoints Darrick J. Wong
2026-10-13 6:08 ` [PATCH 12/12] xfs: don't scan across metadata/regular directory trees for dirents Darrick J. Wong
2026-10-14 8:28 ` [PATCHSET v2 1/2] xfs: LLM-inspired bug fixes, part 22 Carlos Maiolino
-- strict thread matches above, loose matches on Subject: below --
2026-10-12 5:55 [PATCHSET " Darrick J. Wong
2026-10-12 5:57 ` [PATCH 06/12] xfs: only written file data blocks can be shared Darrick J. Wong
2026-10-12 13:09 ` Christoph Hellwig
2026-10-12 15:52 ` Darrick J. Wong
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=20261014174003.GI2705364@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.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