From: Darrick J. Wong <djwong@xxxxxxxxxx> If secondary_sb_whack detects nonzero bytes beyond the end of the ondisk superblock, it will try to zero the end of the ondisk buffer as well as the incore superblock prior to scan_ag using that incore super to rewrite the ondisk super. However, the metadata directory feature adds a sb_metadirino field to the incore super. On disk, this is stored in the same slot as sb_rbmino, but we wanted to cache both inumbers incore to minimize the churn. Therefore, it is now only safe to zero the "end" of an xfs_dsb buffer, and never an xfs_sb object. Most of the XFS codebase moved off that second behavior long ago, with the exception of this one part of repair. The zeroing probably ought to be turned into explicit logic to zero fields that weren't defined with the featureset encoded in the primary superblock, but for now we'll resort to always resetting the values from the xfs_mount's xfs_sb. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- repair/agheader.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/repair/agheader.c b/repair/agheader.c index 3930a0ac091..af88802ffdf 100644 --- a/repair/agheader.c +++ b/repair/agheader.c @@ -405,6 +405,13 @@ secondary_sb_whack( mp->m_sb.sb_sectsize - size); /* Preserve meta_uuid so we don't fail uuid checks */ memcpy(&sb->sb_meta_uuid, &tmpuuid, sizeof(uuid_t)); + + /* + * Preserve the parts of the incore super that extend + * beyond the part that's supposed to match the ondisk + * super byte for byte. + */ + sb->sb_metadirino = mp->m_sb.sb_metadirino; } else do_warn( _("would zero unused portion of %s superblock (AG #%u)\n"),