[PATCH 17/38] xfs_repair: check metadir superblock padding fields

Darrick J. Wong
2024-10-11T01:18:36Z

Since metadir removes sb_bad_features2 from the ondisk superblock, check
that the padding field is zeroed.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
repair/sb.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/repair/sb.c b/repair/sb.c
index 1320929caee590..80b09225cd97d2 100644
--- a/repair/sb.c
+++ b/repair/sb.c
@@ -479,6 +479,11 @@ verify_sb(char *sb_buf, xfs_sb_t *sb, int is_primary_sb)
if (sb->sb_blocklog + sb->sb_dirblklog > XFS_MAX_BLOCKSIZE_LOG)
return XR_BAD_DIR_SIZE_DATA;

+ if (xfs_sb_version_hasmetadir(sb)) {
+ if (sb->sb_metadirpad)
+ return XR_SB_GEO_MISMATCH;
+ }
+
return(XR_OK);
}