Re: [PATCH 2/8] common/rc: fix _require_xfs_io_shutdown

Darrick J. Wong
2025-10-24T22:08:49Z

On Fri, Oct 24, 2025 at 01:01:50PM +0530, Nirjhar Roy (IBM) wrote:
> On Wed, 2025-10-15 at 09:37 -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Capturing the output of _scratch_shutdown_handle requires one to enclose
> > the callsite with $(), otherwise you're comparing the literal string
> > "_scratch_shutdown_handle" to $SCRATCH_MNT, which always fails.
> >
> > Also fix _require_xfs_io_command to handle testing the shutdown command
> > correctly.
> >
> > Cc: <fstests@vger.kernel.org> # v2025.06.22
> > Fixes: 4b1cf3df009b22 ("fstests: add helper _require_xfs_io_shutdown")
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> > common/rc | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> >
> > diff --git a/common/rc b/common/rc
> > index 1ec84263c917c0..1b78cd0c358bb9 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -619,7 +619,7 @@ _scratch_shutdown_and_syncfs()
> > # requirement down to _require_scratch_shutdown.
> > _require_xfs_io_shutdown()
> > {
> > - if [ _scratch_shutdown_handle != $SCRATCH_MNT ]; then
> > + if [ $(_scratch_shutdown_handle) != $SCRATCH_MNT ]; then
> Yeah, right. _scratch_shutdown_handle is a function call and should be placed in a $() or ``.
> > # Most likely overlayfs
> > _notrun "xfs_io -c shutdown not supported on $FSTYP"
> > fi
> > @@ -3073,6 +3073,11 @@ _require_xfs_io_command()
> > rm -f $testfile.1
> > param_checked="$param"
> > ;;
> > + "shutdown")
> > + testio=$($XFS_IO_PROG -f -x -c "$command $param" $testfile 2>&1)
> > + param_checked="$param"
> > + _test_cycle_mount
> > + ;;
> Looks good to me. Just curious, any reason why we are testing with TEST_DIR and not with
> SCRATCH_MNT?

$TEST_DIR is always available and mounted, whereas SCRATCH_* are
optional.

> Reviewed-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>

Thanks!

--D

> > "utimes" )
> > testio=`$XFS_IO_PROG -f -c "utimes 0 0 0 0" $testfile 2>&1`
> > ;;
> >
>