From 4b1cf3df009b225c5112eacf62250331da00273a Mon Sep 17 00:00:00 2001 From: Amir Goldstein Date: Mon, 9 Jun 2025 17:19:14 +0200 Subject: [PATCH] fstests: add helper _require_xfs_io_shutdown MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Link: https://lore.kernel.org/linux-fsdevel/20250521-ovl_ro-v1-1-2350b1493d94@igalia.com/ Signed-off-by: Amir Goldstein Tested-by: André Almeida Reviewed-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- common/rc | 21 +++++++++++++++++++++ tests/generic/623 | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index 8b285a2d..fbab26b2 100644 --- 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 diff --git a/tests/generic/623 b/tests/generic/623 index b97e2adb..f546d529 100755 --- a/tests/generic/623 +++ b/tests/generic/623 @@ -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 -- 2.47.3