Re: [PATCH 04/14] xfs: set up common code for testing xfs_healer

Darrick J. Wong
2026-03-15T04:51:34Z

On Sun, Mar 15, 2026 at 04:37:59AM +0800, Zorro Lang wrote:
> On Mon, Mar 09, 2026 at 08:51:10PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Add a bunch of common code so that we can test the xfs_healer daemon.
> > Most of the changes here are to make it easier to manage the systemd
> > service units for xfs_healer and xfs_scrub.
> >
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> > common/config | 14 ++++++++
> > common/rc | 5 +++
> > common/systemd | 39 ++++++++++++++++++++++
> > common/xfs | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > tests/xfs/802 | 4 +-
> > 5 files changed, 158 insertions(+), 2 deletions(-)
> >
>
> [snip]
>
> > +# Compute the xfs_scrub systemd service instance name for a given path. This
> > +# is tricky because xfs_scrub only gained --svcname when xfs_healer was made.
> > +_xfs_scrub_svcname()
> > +{
> > + local ret
> > +
> > + if ret="$($XFS_SCRUB_PROG --svcname "$@")"; then
>
> Better to be:
>
> - if ret="$($XFS_SCRUB_PROG --svcname "$@")"; then
> + if ret="$($XFS_SCRUB_PROG --svcname "$@" 2>/dev/null)"; then
>
> Or below xfs/802 will ...
>
> > + echo "$ret"
> > + return 0
> > + fi
>
> [snip]
>
> > diff --git a/tests/xfs/802 b/tests/xfs/802
> > index fc4767acb66a55..18312b15b645bd 100755
> > --- a/tests/xfs/802
> > +++ b/tests/xfs/802
> > @@ -105,8 +105,8 @@ run_scrub_service() {
> > }
> >
> > echo "Scrub Scratch FS"
> > -scratch_path=$(systemd-escape --path "$SCRATCH_MNT")
> > -run_scrub_service xfs_scrub@$scratch_path
> > +svc="$(_xfs_scrub_svcname "$SCRATCH_MNT")"
>
> ... fails on old xfsprogs as:
>
> --- /dev/fd/63 2026-03-13 19:16:15.217899866 -0400
> +++ xfs/802.out.bad 2026-03-13 19:16:15.191834546 -0400
> @@ -1,5 +1,21 @@
> QA output created by 802
> Format and populate
> Scrub Scratch FS
> +/usr/sbin/xfs_scrub: invalid option -- '-'
> +Usage: xfs_scrub [OPTIONS] mountpoint
> +
> +Options:
> + -a count Stop after this many errors are found.
> + -b Background mode.
> + -C fd Print progress information to this fd.
> + -e behavior What to do if errors are found.
> + -k Do not FITRIM the free space.
> + -m path Path to /etc/mtab.
> + -n Dry run. Do not modify anything.
> + -p Only optimize, do not fix corruptions.
> + -T Display timing/usage information.
> + -v Verbose output.
> + -V Print version.
> + -x Scrub file data too.
> Scrub Everything
> Scrub Done
>
> If you don't have more suggestion, I'll help to change that :)

That seems the proper correction to make. Thanks for your help!

--D

> Thanks,
> Zorro
>
> > +run_scrub_service "$svc"
> > find_scrub_trace "$SCRATCH_MNT"
> >
> > # Remove the xfs_scrub_all media scan stamp directory (if specified) because we
> >
>