All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix recovery of partial attr removals
@ 2026-10-28  8:09 Christoph Hellwig
  2026-11-02 11:52 ` Carlos Maiolino
  2026-11-04 14:11 ` Carlos Maiolino
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2026-10-28  8:09 UTC (permalink / raw)
  To: cem; +Cc: linux-xfs

When running xfs/753 on parent pointer-enabled file systems with DEBUG
enabled, log recovery will eventually crash after a few dozen iterations
due to an ASSERT that XFS_ATTR_INCOMPLETE is not already set when
xfs_attr3_leaf_setflag is called:

XFS: Assertion failed: (entry->flags & XFS_ATTR_INCOMPLETE) == 0, file: fs/xfs/libxfs/xfs_attr_leaf.c, line: 3045

This is because parent pointer use logged attributes, and the attribute
intents do not track the work that has been done as the transaction
rolls, and the recovery mechanism is to run the operation from scratch.
Because of this various places check for XFS_DA_OP_RECOVERY skip work
already done.  But while recovery tolerates an attribute already fully
removed, it currently trips the above assert for an attribute that
already has the INCOMPLETE bit set, but still exists.  Fix this by
handling the case like all the others.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---

This really wants a Fixes tag and/or a cc stable, but I have a really
hard time coming up with a good one.  The logged attrs are a messy
history with tons of refactoring, but this actually code goes back way
beyond that, but wasn't a problem before the attr item recovery.  Logged
attrs themselves are still only a debug option and not used by default
except for the parent pointer.  Any good suggestions?

 fs/xfs/libxfs/xfs_attr_leaf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index 6068fad9dc9e..82932b5c02fd 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -3042,7 +3042,14 @@ xfs_attr3_leaf_setflag(
 #endif
 	entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
 
-	ASSERT((entry->flags & XFS_ATTR_INCOMPLETE) == 0);
+	if (entry->flags & XFS_ATTR_INCOMPLETE) {
+		if (!(args->op_flags & XFS_DA_OP_RECOVERY)) {
+			ASSERT(args->op_flags & XFS_DA_OP_RECOVERY);
+			return -EFSCORRUPTED;
+		}
+		return 0;
+	}
+
 	entry->flags |= XFS_ATTR_INCOMPLETE;
 	xfs_trans_log_buf(args->trans, bp,
 			XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-04 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28  8:09 [PATCH] xfs: fix recovery of partial attr removals Christoph Hellwig
2026-11-02 11:52 ` Carlos Maiolino
2026-11-03  7:49   ` Christoph Hellwig
2026-11-03  8:15     ` Carlos Maiolino
2026-11-04 14:11 ` Carlos Maiolino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.