Back in the really old days, xfs_repair would generate the new free
space information for the realtime section during phase 5, and write the
contents to the rtbitmap and summary files during phase 6. This was ok
because the incore information isn't used until phase 6.
Then I changed the behavior to check the generated information against
what was on disk and complain about the discrepancies. Unfortunately,
there was a subtle flaw here -- for a non -n run, we'll have regenerated
the AG metadata before we actually check the rt free space information.
If the AG btree regeneration should clobber one of the old rtbitmap or
summary blocks, this will be reported as a corruption even though
nothing's wrong.
Move check_rtmetadata to the end of phase 4 so that this doesn't happen.
Cc: <linux-xfs@vger.kernel.org> # v5.19.0
Fixes: f2e388616d7491 ("xfs_repair: check free rt extent count")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
*/
quotino_check(mp);
quota_sb_check(mp);
+
+ /* Check the rt metadata before we rebuild */
+ if (mp->m_sb.sb_rblocks) {
+ do_log(
+ _(" - generate realtime summary info and bitmap...\n"));
+ check_rtmetadata(mp);
+ }
}
free(sb_ifree_ag);
free(sb_fdblocks_ag);
- if (mp->m_sb.sb_rblocks) {
- do_log(
- _(" - generate realtime summary info and bitmap...\n"));
- check_rtmetadata(mp);
- }
-
do_log(_(" - reset superblock...\n"));
/*
if (no_modify) {
printf(_("No modify flag set, skipping phase 5\n"));
-
- if (mp->m_sb.sb_rblocks > 0)
- check_rtmetadata(mp);
} else {
phase5(mp);
}