Re: [PATCH] xfs: fix online repair probing when CONFIG_XFS_ONLINE_REPAIR=n

"Darrick J. Wong" <[email protected]>
Newsgroups dev.linux.lists.xfs-stable,org.kernel.vger.linux-xfs,org.kernel.vger.stable
Message-ID <20250115062037.GF3557553@frogsfrogsfrogs>
On Wed, Jan 15, 2025 at 07:06:15AM +0100, Christoph Hellwig wrote:
> On Tue, Jan 14, 2025 at 02:48:19PM -0800, Darrick J. Wong wrote:
> > index 950f5a58dcd967..09468f50781b24 100644
> > --- a/fs/xfs/scrub/scrub.c
> > +++ b/fs/xfs/scrub/scrub.c
> > @@ -149,6 +149,15 @@ xchk_probe(
> >  	if (xchk_should_terminate(sc, &error))
> >  		return error;
> >  
> > +	/*
> > +	 * If the caller is probing to see if repair works, set the CORRUPT
> > +	 * flag (without any of the usual tracing/logging) to force us into
> > +	 * the repair codepaths.  If repair is compiled into the kernel, we'll
> > +	 * call xrep_probe and simulate a repair; otherwise, the repair
> > +	 * codepaths return EOPNOTSUPP.
> > +	 */
> > +	if (xchk_could_repair(sc))
> > +		sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
> 
> Stupid question: what is the point in not just directly returning
> -EOPNOTSUPP here when online repair is not supported?

Good point, we could cut it off right then and there.  Though this seems
a little gross:

	if (xchk_could_repair(sc))
#ifdef CONFIG_XFS_ONLINE_REPAIR
		sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
#else
		return -EOPNOTSUPP;
#endif
	return 0;

but I don't mind.  Some day the stubs will go away, fingers crossed.

--D
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.