]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_repair: preserve the metadirino field when zeroing supers
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Nov 2024 00:24:17 +0000 (16:24 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 28 Nov 2024 02:33:11 +0000 (18:33 -0800)
The metadata directory root inumber is now the last field in the
superblock, so extend the zeroing code to know about that.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
repair/agheader.c

index 3930a0ac0919b419f1a490ff3885ba154d16d9d7..fe58d833b8bafa44cdd0a205b7af21e799839e11 100644 (file)
@@ -319,6 +319,12 @@ check_v5_feature_mismatch(
        return XR_AG_SB_SEC;
 }
 
+static inline bool xfs_sb_version_hasmetadir(const struct xfs_sb *sbp)
+{
+       return xfs_sb_is_v5(sbp) &&
+               (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_METADIR);
+}
+
 /*
  * Possible fields that may have been set at mkfs time,
  * sb_inoalignmt, sb_unit, sb_width and sb_dirblklog.
@@ -357,7 +363,10 @@ secondary_sb_whack(
         *
         * size is the size of data which is valid for this sb.
         */
-       if (xfs_sb_version_hasmetauuid(sb))
+       if (xfs_sb_version_hasmetadir(sb))
+               size = offsetof(struct xfs_dsb, sb_metadirino)
+                       + sizeof(sb->sb_metadirino);
+       else if (xfs_sb_version_hasmetauuid(sb))
                size = offsetof(struct xfs_dsb, sb_meta_uuid)
                        + sizeof(sb->sb_meta_uuid);
        else if (xfs_sb_version_hascrc(sb))