]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: don't zap the attr fork on repair when there are queued pptr updates
authorDarrick J. Wong <djwong@kernel.org>
Mon, 27 Jul 2026 05:23:46 +0000 (22:23 -0700)
committerCarlos Maiolino <cem@kernel.org>
Mon, 3 Aug 2026 08:17:34 +0000 (10:17 +0200)
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>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/attr_repair.c

index be627ab655ad16e30eb1d695cddfe6466b1b1a50..6e6af142f1fb8eb7dade4b9a4958954d8e111a1a 100644 (file)
@@ -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)