On Fri, Jan 15, 2021 at 05:24:53PM -0800, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Clear the needsrepair flag, since it's used to prevent mounting of an > inconsistent filesystem. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > --- Code/errors look much cleaner. Though looking at the repair code again, I wonder... if we clear the needsrepair bit and dirty/write the sb in phase 2 and then xfs_repair happens to crash, do we risk clearing the bit and thus allowing a potential mount before whatever requisite metadata updates have been made? Brian > repair/agheader.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > > diff --git a/repair/agheader.c b/repair/agheader.c > index 8bb99489..d9b72d3a 100644 > --- a/repair/agheader.c > +++ b/repair/agheader.c > @@ -452,6 +452,21 @@ secondary_sb_whack( > rval |= XR_AG_SB_SEC; > } > > + if (xfs_sb_version_needsrepair(sb)) { > + if (!no_modify) > + sb->sb_features_incompat &= > + ~XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR; > + if (i == 0) { > + if (!no_modify) > + do_warn( > + _("clearing needsrepair flag and regenerating metadata\n")); > + else > + do_warn( > + _("would clear needsrepair flag and regenerate metadata\n")); > + } > + rval |= XR_AG_SB_SEC; > + } > + > return(rval); > } > >