]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: check da node block pad field during scrub
authorYuto Ohnuki <ytohnuki@amazon.com>
Fri, 10 Apr 2026 17:06:15 +0000 (18:06 +0100)
committerCarlos Maiolino <cem@kernel.org>
Mon, 27 Apr 2026 08:36:36 +0000 (10:36 +0200)
The da node block header (xfs_da3_node_hdr) contains a __pad32 field
that should always be zero. Add a check for this during directory and
attribute btree scrubbing.

Since old kernels may have written non-zero padding without issues, flag
this as an optimization opportunity (preen) rather than corruption.

Signed-off-by: Yuto Ohnuki <ytohnuki@amazon.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/dabtree.c

index 1a71d36898b1d7ffd73b72575ee1d41f11bdce6d..c2d6ad59d03ef21af64dc0192214dd78448e76cc 100644 (file)
@@ -454,7 +454,12 @@ xchk_da_btree_block(
                        }
                }
 
-               /* XXX: Check hdr3.pad32 once we know how to fix it. */
+               if (xfs_has_crc(ip->i_mount)) {
+                       struct xfs_da3_node_hdr *nodehdr3 = blk->bp->b_addr;
+
+                       if (nodehdr3->__pad32)
+                               xchk_da_set_preen(ds, level);
+               }
                break;
        default:
                xchk_da_set_corrupt(ds, level);