Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, cem@kernel.org, hch@lst.de
Cc: stable@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: [PATCH 4/6] xfs: don't zap the attr fork on repair when there are queued pptr updates
Date: Sun, 26 Jul 2026 22:23:46 -0700	[thread overview]
Message-ID: <178512389251.1494795.11990651998732898567.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <178512389129.1494795.16117444961252720216.stgit@frogsfrogsfrogs>

From: Darrick J. Wong <djwong@kernel.org>

LOLLM noticed that xrep_xattr_rebuild_tree doesn't check for queued
parent pointer updates when it decides that it's going to zap the attr
fork.  This is obviously incorrect, so fix that.  We hold the IOLOCK and
the ILOCK of sc->ip at that point in time, so we can't race with any
/new/ operations.

Cc: <stable@vger.kernel.org> # v6.10
Fixes: e5d7ce0364d8ee ("xfs: replay unlocked parent pointer updates that accrue during xattr repair")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/scrub/attr_repair.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


diff --git a/fs/xfs/scrub/attr_repair.c b/fs/xfs/scrub/attr_repair.c
index be627ab655ad16..6e6af142f1fb8e 100644
--- a/fs/xfs/scrub/attr_repair.c
+++ b/fs/xfs/scrub/attr_repair.c
@@ -1427,7 +1427,8 @@ xrep_xattr_rebuild_tree(
 	 * If we didn't find any attributes to salvage, repair the file by
 	 * zapping its attr fork.
 	 */
-	if (rx->attrs_found == 0) {
+	if (rx->attrs_found == 0 &&
+	    (!xfs_has_parent(sc->mp) || xfarray_length(rx->pptr_recs) == 0)) {
 		xfs_trans_ijoin(sc->tp, sc->ip, 0);
 		error = xrep_xattr_reset_fork(sc);
 		if (error)


  parent reply	other threads:[~2026-07-27  5:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27  5:22 [PATCHSET 1/2] xfs: LLM-inspired bug fixes, part 4 Darrick J. Wong
2026-07-27  5:22 ` [PATCH 1/6] xfs: only check mergeability of bnobt records Darrick J. Wong
2026-07-27  5:23 ` [PATCH 2/6] xfs: don't double-lock when deleting a self-referential directory Darrick J. Wong
2026-07-27  5:23 ` [PATCH 3/6] xfs: don't return EFSCORRUPTED when scrubbing corrupt parent pointers Darrick J. Wong
2026-07-27  5:23 ` Darrick J. Wong [this message]
2026-07-27  5:24 ` [PATCH 5/6] xfs: nlink scrub must take IOLOCK before determining ILOCK state Darrick J. Wong
2026-07-27  5:24 ` [PATCH 6/6] xfs: avoid UAF on sc->tempip in xrep_tempfile_create Darrick J. Wong
2026-08-03 13:22 ` [PATCHSET 1/2] xfs: LLM-inspired bug fixes, part 4 Carlos Maiolino
  -- strict thread matches above, loose matches on Subject: below --
2026-07-24  6:21 [PATCHSET] " Darrick J. Wong
2026-07-24  6:22 ` [PATCH 4/6] xfs: don't zap the attr fork on repair when there are queued pptr updates Darrick J. Wong
2026-07-24 13:25   ` Christoph Hellwig
2026-07-24 17:05     ` 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=178512389251.1494795.11990651998732898567.stgit@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --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