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

Darrick J. Wong
2025-10-15T16:37:14Z

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
# 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
+ ;;
"utimes" )
testio=`$XFS_IO_PROG -f -c "utimes 0 0 0 0" $testfile 2>&1`
;;