[PATCH] common: skip data write EIO survival tests on fatal configs
Yao Sang <[email protected]> Tue, 23 Jun 2026 14:26:16 +0800
| Newsgroups | org.kernel.vger.fstests |
|---|---|
| Message-ID | <[email protected]> |
generic/441 and xfs/656 inject data write errors after mounting the scratch filesystem on dm-error. These tests do not verify whether a filesystem may shut down after media errors. They require the filesystem to survive long enough to report the error through the path under test: generic/441 checks fsync(2) writeback error reporting, and xfs/656 checks healthmon per-I/O error events. That expectation is not valid for filesystem configurations where a data write error is fatal. Zoned XFS is one such case because a failed data write can leave the in-core zone allocation state untrustworthy, so shutting down the mount is expected behavior. Add a common helper for tests that require data write EIO to be reported without shutting down the mounted filesystem, and use it after mounting the dm-error device in both tests. The helper currently detects zoned XFS by checking the XFS per-mount zoned/max_open_zones sysfs attribute for the mounted device, so the check follows the filesystem instance rather than the underlying block queue alone. Fatal-on-data-write-error configurations are reported as notrun instead of test failures. Signed-off-by: Yao Sang <[email protected]> --- Changes since RFC: - Replace the separate fatal predicate and survival requirement helpers with a single _require_fs_survives_data_write_eio helper. - Drop the FS_DATA_WRITE_EIO_SHUTDOWN override. - Require callers to pass the mounted device explicitly. - Remove _scratch from the helper name. - Keep the XFS per-mount zoned/max_open_zones detection. RFC Link: https://lore.kernel.org/fstests/[email protected]/ common/rc | 22 ++++++++++++++++++++++ tests/generic/441 | 1 + tests/xfs/656 | 1 + 3 files changed, 24 insertions(+) diff --git a/common/rc b/common/rc index 9632b211..4bf0861b 100644 --- a/common/rc +++ b/common/rc @@ -4162,6 +4162,28 @@ _require_scratch_shutdown_and_syncfs() _require_scratch_shutdown } +# Require that the mounted filesystem survive data write errors long enough to +# report them through the regular error reporting path. +_require_fs_survives_data_write_eio() +{ + local dev=$1 + + if [ ! -b "$dev" ]; then + _fail "Usage: _require_fs_survives_data_write_eio <mounted_device>" + fi + + case "$FSTYP" in + xfs) + # This is an XFS per-mount sysfs attribute, not a block queue + # attribute. Its existence means XFS mounted this instance with + # zoned filesystem semantics. + if _has_fs_sysfs_attr "$dev" "zoned/max_open_zones"; then + _notrun "zoned XFS shuts down on data write EIO" + fi + ;; + esac +} + _check_s_dax() { local target=$1 diff --git a/tests/generic/441 b/tests/generic/441 index 6b48fc9e..cc370bea 100755 --- a/tests/generic/441 +++ b/tests/generic/441 @@ -53,6 +53,7 @@ echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 _dmerror_init no_log _dmerror_mount +_require_fs_survives_data_write_eio $DMERROR_DEV _require_fs_space $SCRATCH_MNT 65536 diff --git a/tests/xfs/656 b/tests/xfs/656 index 3a867692..3830d719 100755 --- a/tests/xfs/656 +++ b/tests/xfs/656 @@ -48,6 +48,7 @@ echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 _dmerror_init no_log _dmerror_mount +_require_fs_survives_data_write_eio $DMERROR_DEV _require_fs_space $SCRATCH_MNT 65536 -- 2.25.1