From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 28/40] filters: add a filter that accepts EIO instead of other errors
Date: Wed, 27 Nov 2024 15:51:58 +1100 [thread overview]
Message-ID: <20241127045403.3665299-29-david@fromorbit.com> (raw)
In-Reply-To: <20241127045403.3665299-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Running a dm-flakey or dm-error test that loads a table that returns
EIO to all IO and then running a command that is expected to fail
with a specific error is racy.
If there is memory pressure at the same time that the table is
loaded, cached inodes can be turfed from memory and the command then
needs to read the inode it is about to act on from disk again. This
results in the inode read getting EIO and failing (e.g. xfs_io will
return a stat() error) rather than having the desired operation
fail.
This results in spurious test failures that look like this:
generic/331 - output mismatch (see /mnt/xfs/runner-41/results-2024-11-20-10:57:31/xfs/generic/331.out.bad)
--- tests/generic/331.out 2022-12-21 15:53:25.487044098 +1100
+++ /mnt/xfs/runner-41/results-2024-11-20-10:57:31/xfs/generic/331.out.bad 2024-11-20 11:02:12.123572607 +1100
@@ -5,7 +5,8 @@
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-331/file1
1886e67cf8783e89ce6ddc5bb09a3944 SCRATCH_MNT/test-331/file2
CoW and unmount
-fdatasync: Input/output error
+/mnt/xfs/runner-41/scratch/test-331/file2: Input/output error
+stat: Input/output error
Compare files
...
Add a new "flakey EIO filter" that will catch -any- EIO error from
the command and change it to the error we expected to see.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
common/filter | 9 +++++++++
tests/btrfs/160 | 3 ++-
tests/generic/252 | 3 ++-
tests/generic/329 | 3 ++-
tests/generic/331 | 5 +++--
tests/generic/484 | 3 ++-
tests/generic/743 | 4 +++-
tests/xfs/237 | 3 ++-
tests/xfs/240 | 5 +++--
9 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/common/filter b/common/filter
index 6a509d8b5..7e02ded37 100644
--- a/common/filter
+++ b/common/filter
@@ -662,5 +662,14 @@ _filter_trailing_whitespace()
sed -E -e "s/\s+$//"
}
+# Catch -any- EIO error regardless of it's source and replace it with the
+# supplied error message.
+_filter_flakey_EIO()
+{
+ local message="$*"
+
+ sed -e "s#.*: Input\/output error#$message#"
+}
+
# make sure this script returns success
/bin/true
diff --git a/tests/btrfs/160 b/tests/btrfs/160
index 04ed1f176..c4a01d330 100755
--- a/tests/btrfs/160
+++ b/tests/btrfs/160
@@ -66,7 +66,8 @@ _dmerror_load_working_table
# open again and call fsync
echo "The following fsync should fail with EIO:"
-$XFS_IO_PROG -c fsync $testfile
+$XFS_IO_PROG -c fsync $testfile |& \
+ _filter_flakey_EIO "fsync: Input/output error"
echo "done"
# close file
diff --git a/tests/generic/252 b/tests/generic/252
index ddf950e34..2ad0524c2 100755
--- a/tests/generic/252
+++ b/tests/generic/252
@@ -66,7 +66,8 @@ $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
_scratch_sync
_dmerror_load_error_table
-$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 |& \
+ _filter_flakey_EIO "write missed bytes expect 8388608 got 0"
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
diff --git a/tests/generic/329 b/tests/generic/329
index e4300f92c..96a5ad54c 100755
--- a/tests/generic/329
+++ b/tests/generic/329
@@ -59,7 +59,8 @@ $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
_scratch_sync
_dmerror_load_error_table
-$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 |& \
+ _filter_flakey_EIO "write missed bytes expect 8388608 got 0"
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
diff --git a/tests/generic/331 b/tests/generic/331
index fe12ec4eb..704bb1283 100755
--- a/tests/generic/331
+++ b/tests/generic/331
@@ -59,8 +59,9 @@ $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
_scratch_sync
_dmerror_load_error_table
-$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -c "fdatasync" $testdir/file2
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "fdatasync" $testdir/file2 |& \
+ _filter_flakey_EIO "fdatasync: Input/output error"
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
diff --git a/tests/generic/484 b/tests/generic/484
index 09c2c5598..ec50735a5 100755
--- a/tests/generic/484
+++ b/tests/generic/484
@@ -54,7 +54,8 @@ $XFS_IO_PROG -c "pwrite -W -q 0 $datalen" $testfile
_dmerror_load_error_table
# rewrite the data and call fdatasync
-$XFS_IO_PROG -c "pwrite -w -q 0 $datalen" $testfile
+$XFS_IO_PROG -c "pwrite -w -q 0 $datalen" $testfile |& \
+ _filter_flakey_EIO "fdatasync: Input/output error"
# heal the device error
_dmerror_load_working_table
diff --git a/tests/generic/743 b/tests/generic/743
index 228ba764e..efdeec82d 100755
--- a/tests/generic/743
+++ b/tests/generic/743
@@ -21,6 +21,7 @@ _cleanup()
}
# Import common functions.
+. ./common/filter
. ./common/dmerror
_fixed_by_kernel_commit 631426ba1d45 \
@@ -55,7 +56,8 @@ _dmerror_mount
stat "$SCRATCH_MNT/a" >> $seqres.full
echo read with IO errors
_dmerror_load_error_table
-$TIMEOUT_PROG -s KILL 10s $XFS_IO_PROG -c "mmap -r 0 $filesz" -c "madvise -R 0 $filesz" "$SCRATCH_MNT/a"
+$TIMEOUT_PROG -s KILL 10s $XFS_IO_PROG -c "mmap -r 0 $filesz" -c "madvise -R 0 $filesz" "$SCRATCH_MNT/a" |& \
+ _filter_flakey_EIO "madvise: Bad address"
_dmerror_load_working_table
# success, all done
diff --git a/tests/xfs/237 b/tests/xfs/237
index 91f56d6c1..eb5dc5d2f 100755
--- a/tests/xfs/237
+++ b/tests/xfs/237
@@ -68,7 +68,8 @@ $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
_scratch_sync
_dmerror_load_error_table
-$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
+$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 |& \
+ _filter_flakey_EIO "write missed bytes expect 8388608 got 0"
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
diff --git a/tests/xfs/240 b/tests/xfs/240
index e95cf3f5d..8916828a8 100755
--- a/tests/xfs/240
+++ b/tests/xfs/240
@@ -64,8 +64,9 @@ $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
_scratch_sync
_dmerror_load_error_table
-$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
-$XFS_IO_PROG -c "fdatasync" $testdir/file2
+$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full 2>&1
+$XFS_IO_PROG -c "fdatasync" $testdir/file2 |& \
+ _filter_flakey_EIO "fdatasync: Input/output error"
_dmerror_load_working_table
_dmerror_unmount
_dmerror_mount
--
2.45.2
next prev parent reply other threads:[~2024-11-27 4:59 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 4:51 [RFC PATCH 00/40] fstests: concurrent test execution Dave Chinner
2024-11-27 4:51 ` [PATCH 01/40] xfs/448: get rid of assert-on-failure Dave Chinner
2024-11-27 4:51 ` [PATCH 02/40] fstests: cleanup fsstress process management Dave Chinner
2024-11-29 4:03 ` Zorro Lang
2024-12-04 17:57 ` Zorro Lang
2024-12-05 4:42 ` Dave Chinner
2024-12-05 9:57 ` Zorro Lang
2024-12-04 18:04 ` Zorro Lang
2024-12-05 4:55 ` Dave Chinner
2024-12-05 10:05 ` Zorro Lang
2024-11-27 4:51 ` [PATCH 03/40] fuzzy: don't use killall Dave Chinner
2024-11-27 4:51 ` [PATCH 04/40] fstests: per-test dmflakey instances Dave Chinner
2024-11-27 4:51 ` [PATCH 05/40] fstests: per-test dmerror instances Dave Chinner
2024-11-27 4:51 ` [PATCH 06/40] fstests: per-test dmhuge instances Dave Chinner
2024-11-27 4:51 ` [PATCH 07/40] fstests: per-test dmthin instances Dave Chinner
2024-11-27 4:51 ` [PATCH 08/40] fstests: per-test dmdust instances Dave Chinner
2024-11-27 4:51 ` [PATCH 09/40] fstests: per-test dmdelay instances Dave Chinner
2024-11-27 4:51 ` [PATCH 10/40] fstests: fix DM device creation/removal vs udev races Dave Chinner
2024-11-27 4:51 ` [PATCH 11/40] fstests: use syncfs rather than sync Dave Chinner
2024-11-27 4:51 ` [PATCH 12/40] fstests: clean up mount and unmount operations Dave Chinner
2024-11-27 4:51 ` [PATCH 13/40] fstests: clean up loop device instantiation Dave Chinner
2024-12-01 12:31 ` Zorro Lang
2024-12-01 12:50 ` Zorro Lang
2024-12-07 12:44 ` Zorro Lang
2024-12-07 18:59 ` Zorro Lang
2024-12-07 19:51 ` Zorro Lang
2024-11-27 4:51 ` [PATCH 14/40] fstests: xfs/227 is really slow Dave Chinner
2024-11-27 4:51 ` [PATCH 15/40] fstests: mark tests that are unreliable when run in parallel Dave Chinner
2024-11-27 4:51 ` [PATCH 16/40] fstests: use udevadm wait in preference to settle Dave Chinner
2024-11-29 17:10 ` Darrick J. Wong
2024-11-29 22:33 ` Dave Chinner
2024-11-30 2:34 ` Zorro Lang
2024-11-27 4:51 ` [PATCH 17/40] xfs/442: rescale load so it's not exponential Dave Chinner
2024-11-27 4:51 ` [PATCH 18/40] xfs/176: fix broken setup code Dave Chinner
2024-11-27 4:51 ` [PATCH 19/40] xfs/177: remove unused slab object count location checks Dave Chinner
2024-11-27 4:51 ` [PATCH 20/40] fstests: remove uses of killall where possible Dave Chinner
2024-11-27 4:51 ` [PATCH 21/40] generic/127: reduce runtime Dave Chinner
2024-11-27 4:51 ` [PATCH 22/40] quota: system project quota files need to be shared Dave Chinner
2024-11-27 4:51 ` [PATCH 23/40] dmesg: reduce noise from other tests Dave Chinner
2024-11-27 4:51 ` [PATCH 24/40] fstests: stop using /tmp directly Dave Chinner
2024-11-27 4:51 ` [PATCH 25/40] fstests: scale some tests for high CPU count sanity Dave Chinner
2024-11-29 3:34 ` Zorro Lang
2024-11-27 4:51 ` [PATCH 26/40] generic/310: cleanup killing background processes Dave Chinner
2024-11-27 4:51 ` [PATCH 27/40] filter: handle mount errors from CONFIG_BLK_DEV_WRITE_MOUNTED=y Dave Chinner
2024-11-27 4:51 ` Dave Chinner [this message]
2024-11-27 4:51 ` [PATCH 29/40] generic/085: general cleanup for reliability and debugging Dave Chinner
2024-11-27 4:52 ` [PATCH 30/40] fstests: don't use directory stacks Dave Chinner
2024-12-01 12:10 ` Zorro Lang
2024-12-01 21:37 ` Dave Chinner
2024-11-27 4:52 ` [PATCH 31/40] fstests: clean up a couple of dm-flakey tests Dave Chinner
2024-11-27 4:52 ` [PATCH 32/40] fstests: clean up termination of various tests Dave Chinner
2024-11-27 4:52 ` [PATCH 33/40] vfstests: some tests require the testdir to be shared Dave Chinner
2024-11-27 4:52 ` [PATCH 34/40] xfs/629: single extent files should be within tolerance Dave Chinner
2024-11-27 4:52 ` [PATCH 35/40] xfs/076: fix broken mkfs filtering Dave Chinner
2024-11-27 4:52 ` [PATCH 36/40] fstests: capture some failures to seqres.full Dave Chinner
2024-11-27 4:52 ` [PATCH 37/40] fstests: always use fail-at-unmount semantics for XFS Dave Chinner
2024-11-27 4:52 ` [PATCH 38/40] generic/062: don't leave debug files in $here on failure Dave Chinner
2024-11-27 4:52 ` [PATCH 39/40] fstests: quota grace periods unreliable under load Dave Chinner
2024-11-27 4:52 ` [PATCH 40/40] fstests: check-parallel Dave Chinner
2024-11-29 4:22 ` [RFC PATCH 00/40] fstests: concurrent test execution Zorro Lang
2024-12-07 0:09 ` Darrick J. Wong
2024-12-07 9:38 ` Zorro Lang
2024-12-08 0:02 ` Dave Chinner
2024-12-08 6:15 ` Zorro Lang
2024-12-10 0:55 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241127045403.3665299-29-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox