]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fstests: add helper _require_xfs_io_shutdown
authorAmir Goldstein <amir73il@gmail.com>
Mon, 9 Jun 2025 15:19:14 +0000 (17:19 +0200)
committerZorro Lang <zlang@kernel.org>
Fri, 20 Jun 2025 16:46:47 +0000 (00:46 +0800)
Requirements for tests that shutdown fs using "xfs_io -c shutdown".
The requirements are stricter than the requirement for tests that
shutdown fs using _scratch_shutdown helper.

Generally, with overlay fs, tests can do _scratch_shutdown, but not
xfs_io -c shutdown.

Encode this stricter requirement in helper _require_xfs_io_shutdown
and use it in test generic/623, to express that it cannot run on
overalyfs.

Reported-by: André Almeida <andrealmeid@igalia.com>
Link: https://lore.kernel.org/linux-fsdevel/20250521-ovl_ro-v1-1-2350b1493d94@igalia.com/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Tested-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc
tests/generic/623

index 8b285a2d12f27cd84bba4730f77b0a059f59d7ba..fbab26b25d00866b4601e780d8c3f3e7a3d4e73d 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -616,6 +616,27 @@ _scratch_shutdown_and_syncfs()
        fi
 }
 
+# Requirements for tests that shutdown fs using "xfs_io -c shutdown".
+# The requirements are stricter than the requirement for tests that
+# shutdown fs using _scratch_shutdown helper.
+# Generally, with overlay fs, test can do _scratch_shutdown, but not
+# xfs_io -c shutdown.
+# It is possible, but not trivial, to execute "xfs_io -c shutdown" as part
+# of a command sequence when shutdown ioctl is to be performed on the base fs
+# (i.e. on an alternative _scratch_shutdown_handle path) as the example code
+# in _scratch_shutdown_and_syncfs() does.
+# A test that open codes this pattern can relax the _require_xfs_io_shutdown
+# requirement down to _require_scratch_shutdown.
+_require_xfs_io_shutdown()
+{
+       if [ _scratch_shutdown_handle != $SCRATCH_MNT ]; then
+               # Most likely overlayfs
+               _notrun "xfs_io -c shutdown not supported on $FSTYP"
+       fi
+       _require_xfs_io_command "shutdown"
+       _require_scratch_shutdown
+}
+
 _move_mount()
 {
        local mnt=$1
index b97e2adbe67f729ea90ce9b1373b8b07e206b686..f546d529a32f193e363813ac0106c41a5cf97e40 100755 (executable)
@@ -15,7 +15,7 @@ _begin_fstest auto quick shutdown mmap
        "xfs: restore shutdown check in mapped write fault path"
 
 _require_scratch_nocheck
-_require_scratch_shutdown
+_require_xfs_io_shutdown
 
 _scratch_mkfs &>> $seqres.full
 _scratch_mount