From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 05/40] fstests: per-test dmerror instances
Date: Wed, 27 Nov 2024 15:51:35 +1100 [thread overview]
Message-ID: <20241127045403.3665299-6-david@fromorbit.com> (raw)
In-Reply-To: <20241127045403.3665299-1-david@fromorbit.com>
We can't run two tests that use dmerror at the same time because
the device name is the same. hence they interfere with each other.
Give dmerror devices their own per-test names to avoid this
problem.
Note that we need a hack to pass the test sequence number through
to src/dmerror as used by generic/441 so that it can construct the
dmerror name correctly.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
common/dmerror | 70 +++++++++++++++++++++++++----------------------
src/dmerror | 6 +++-
tests/generic/441 | 2 +-
3 files changed, 43 insertions(+), 35 deletions(-)
diff --git a/common/dmerror b/common/dmerror
index 3494b6dd3..97796b38e 100644
--- a/common/dmerror
+++ b/common/dmerror
@@ -4,6 +4,10 @@
#
# common functions for setting up and tearing down a dmerror device
+export DMERROR_NAME="error-test.$seq"
+export DMERROR_RTNAME="error-rttest.$seq"
+export DMERROR_LOGNAME="error-logtest.$seq"
+
_dmerror_setup_vars()
{
local backing_dev="$1"
@@ -31,7 +35,7 @@ _dmerror_setup()
done
# Scratch device
- export DMERROR_DEV='/dev/mapper/error-test'
+ export DMERROR_DEV="/dev/mapper/$DMERROR_NAME"
_dmerror_setup_vars $SCRATCH_DEV
# Realtime device. We reassign SCRATCH_RTDEV so that all the scratch
@@ -41,7 +45,7 @@ _dmerror_setup()
# Set up the device switch
local dm_backing_dev=$SCRATCH_RTDEV
export NON_ERROR_RTDEV="$SCRATCH_RTDEV"
- SCRATCH_RTDEV='/dev/mapper/error-rttest'
+ SCRATCH_RTDEV="/dev/mapper/$DMERROR_RTNAME"
else
# Already set up; recreate tables
local dm_backing_dev="$NON_ERROR_RTDEV"
@@ -57,7 +61,7 @@ _dmerror_setup()
# Set up the device switch
local dm_backing_dev=$SCRATCH_LOGDEV
export NON_ERROR_LOGDEV="$SCRATCH_LOGDEV"
- SCRATCH_LOGDEV='/dev/mapper/error-logtest'
+ SCRATCH_LOGDEV="/dev/mapper/$DMERROR_LOGNAME"
else
# Already set up; recreate tables
local dm_backing_dev="$NON_ERROR_LOGDEV"
@@ -71,19 +75,19 @@ _dmerror_init()
{
_dmerror_setup "$@"
- _dmsetup_remove error-test
- _dmsetup_create error-test --table "$DMLINEAR_TABLE" || \
+ _dmsetup_remove $DMERROR_NAME
+ _dmsetup_create $DMERROR_NAME --table "$DMLINEAR_TABLE" || \
_fatal "failed to create dm linear device"
if [ -n "$NON_ERROR_RTDEV" ]; then
- _dmsetup_remove error-rttest
- _dmsetup_create error-rttest --table "$DMLINEAR_RTTABLE" || \
+ _dmsetup_remove $DMERROR_RTNAME
+ _dmsetup_create $DMERROR_RTNAME --table "$DMLINEAR_RTTABLE" || \
_fatal "failed to create dm linear rt device"
fi
if [ -n "$NON_ERROR_LOGDEV" ]; then
- _dmsetup_remove error-logtest
- _dmsetup_create error-logtest --table "$DMLINEAR_LOGTABLE" || \
+ _dmsetup_remove $DMERROR_LOGNAME
+ _dmsetup_create $DMERROR_LOGNAME --table "$DMLINEAR_LOGTABLE" || \
_fatal "failed to create dm linear log device"
fi
}
@@ -102,15 +106,15 @@ _dmerror_unmount()
_dmerror_cleanup()
{
- test -n "$NON_ERROR_LOGDEV" && $DMSETUP_PROG resume error-logtest &>/dev/null
- test -n "$NON_ERROR_RTDEV" && $DMSETUP_PROG resume error-rttest &>/dev/null
- $DMSETUP_PROG resume error-test > /dev/null 2>&1
+ test -n "$NON_ERROR_LOGDEV" && $DMSETUP_PROG resume $DMERROR_LOGNAME &>/dev/null
+ test -n "$NON_ERROR_RTDEV" && $DMSETUP_PROG resume $DMERROR_RTNAME &>/dev/null
+ $DMSETUP_PROG resume $DMERROR_NAME > /dev/null 2>&1
$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
- test -n "$NON_ERROR_LOGDEV" && _dmsetup_remove error-logtest
- test -n "$NON_ERROR_RTDEV" && _dmsetup_remove error-rttest
- _dmsetup_remove error-test
+ test -n "$NON_ERROR_LOGDEV" && _dmsetup_remove $DMERROR_LOGNAME
+ test -n "$NON_ERROR_RTDEV" && _dmsetup_remove $DMERROR_RTNAME
+ _dmsetup_remove $DMERROR_NAME
unset DMERROR_DEV DMLINEAR_TABLE DMERROR_TABLE
@@ -145,45 +149,45 @@ _dmerror_load_error_table()
# Suspend the scratch device before the log and realtime devices so
# that the kernel can freeze and flush the filesystem if the caller
# wanted a freeze.
- $DMSETUP_PROG suspend $suspend_opt error-test
+ $DMSETUP_PROG suspend $suspend_opt $DMERROR_NAME
[ $? -ne 0 ] && _fail "dmsetup suspend failed"
if [ -n "$NON_ERROR_RTDEV" ]; then
- $DMSETUP_PROG suspend $suspend_opt error-rttest
+ $DMSETUP_PROG suspend $suspend_opt $DMERROR_RTNAME
[ $? -ne 0 ] && _fail "failed to suspend error-rttest"
fi
if [ -n "$NON_ERROR_LOGDEV" ]; then
- $DMSETUP_PROG suspend $suspend_opt error-logtest
+ $DMSETUP_PROG suspend $suspend_opt $DMERROR_LOGNAME
[ $? -ne 0 ] && _fail "failed to suspend error-logtest"
fi
# Load new table
- $DMSETUP_PROG load error-test --table "$DMERROR_TABLE"
+ $DMSETUP_PROG load $DMERROR_NAME --table "$DMERROR_TABLE"
load_res=$?
if [ -n "$NON_ERROR_RTDEV" ]; then
- $DMSETUP_PROG load error-rttest --table "$DMERROR_RTTABLE"
+ $DMSETUP_PROG load $DMERROR_RTNAME --table "$DMERROR_RTTABLE"
[ $? -ne 0 ] && _fail "failed to load error table into error-rttest"
fi
if [ -n "$NON_ERROR_LOGDEV" ]; then
- $DMSETUP_PROG load error-logtest --table "$DMERROR_LOGTABLE"
+ $DMSETUP_PROG load $DMERROR_LOGNAME --table "$DMERROR_LOGTABLE"
[ $? -ne 0 ] && _fail "failed to load error table into error-logtest"
fi
# Resume devices in the opposite order that we suspended them.
if [ -n "$NON_ERROR_LOGDEV" ]; then
- $DMSETUP_PROG resume error-logtest
+ $DMSETUP_PROG resume $DMERROR_LOGNAME
[ $? -ne 0 ] && _fail "failed to resume error-logtest"
fi
if [ -n "$NON_ERROR_RTDEV" ]; then
- $DMSETUP_PROG resume error-rttest
+ $DMSETUP_PROG resume $DMERROR_RTNAME
[ $? -ne 0 ] && _fail "failed to resume error-rttest"
fi
- $DMSETUP_PROG resume error-test
+ $DMSETUP_PROG resume $DMERROR_NAME
resume_res=$?
[ $load_res -ne 0 ] && _fail "dmsetup failed to load error table"
@@ -206,45 +210,45 @@ _dmerror_load_working_table()
# Suspend the scratch device before the log and realtime devices so
# that the kernel can freeze and flush the filesystem if the caller
# wanted a freeze.
- $DMSETUP_PROG suspend $suspend_opt error-test
+ $DMSETUP_PROG suspend $suspend_opt $DMERROR_NAME
[ $? -ne 0 ] && _fail "dmsetup suspend failed"
if [ -n "$NON_ERROR_RTDEV" ]; then
- $DMSETUP_PROG suspend $suspend_opt error-rttest
+ $DMSETUP_PROG suspend $suspend_opt $DMERROR_RTNAME
[ $? -ne 0 ] && _fail "failed to suspend error-rttest"
fi
if [ -n "$NON_ERROR_LOGDEV" ]; then
- $DMSETUP_PROG suspend $suspend_opt error-logtest
+ $DMSETUP_PROG suspend $suspend_opt $DMERROR_LOGNAME
[ $? -ne 0 ] && _fail "failed to suspend error-logtest"
fi
# Load new table
- $DMSETUP_PROG load error-test --table "$DMLINEAR_TABLE"
+ $DMSETUP_PROG load $DMERROR_NAME --table "$DMLINEAR_TABLE"
load_res=$?
if [ -n "$NON_ERROR_RTDEV" ]; then
- $DMSETUP_PROG load error-rttest --table "$DMLINEAR_RTTABLE"
+ $DMSETUP_PROG load $DMERROR_RTNAME --table "$DMLINEAR_RTTABLE"
[ $? -ne 0 ] && _fail "failed to load working table into error-rttest"
fi
if [ -n "$NON_ERROR_LOGDEV" ]; then
- $DMSETUP_PROG load error-logtest --table "$DMLINEAR_LOGTABLE"
+ $DMSETUP_PROG load $DMERROR_LOGNAME --table "$DMLINEAR_LOGTABLE"
[ $? -ne 0 ] && _fail "failed to load working table into error-logtest"
fi
# Resume devices in the opposite order that we suspended them.
if [ -n "$NON_ERROR_LOGDEV" ]; then
- $DMSETUP_PROG resume error-logtest
+ $DMSETUP_PROG resume $DMERROR_LOGNAME
[ $? -ne 0 ] && _fail "failed to resume error-logtest"
fi
if [ -n "$NON_ERROR_RTDEV" ]; then
- $DMSETUP_PROG resume error-rttest
+ $DMSETUP_PROG resume $DMERROR_RTNAME
[ $? -ne 0 ] && _fail "failed to resume error-rttest"
fi
- $DMSETUP_PROG resume error-test
+ $DMSETUP_PROG resume $DMERROR_NAME
resume_res=$?
[ $load_res -ne 0 ] && _fail "dmsetup failed to load error table"
diff --git a/src/dmerror b/src/dmerror
index cde2b4284..96611b101 100755
--- a/src/dmerror
+++ b/src/dmerror
@@ -2,6 +2,10 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2017, Jeff Layton <jlayton@redhat.com>
+# hackity hack hack - first arg is the test number, second arg is op.
+# This is needed so that dmerror names the dm dev correctly.
+seq=$1
+
. ./common/config
. ./common/dmerror
@@ -10,7 +14,7 @@ if [ -z "$DMERROR_DEV" ]; then
exit 1
fi
-case $1 in
+case $2 in
load_error_table)
_dmerror_load_error_table
;;
diff --git a/tests/generic/441 b/tests/generic/441
index 9851ac219..6b48fc9ed 100755
--- a/tests/generic/441
+++ b/tests/generic/441
@@ -59,7 +59,7 @@ _require_fs_space $SCRATCH_MNT 65536
testfile=$SCRATCH_MNT/fsync-err-test
echo "$here/src/fsync-err $sflag -d $here/src/dmerror $testfile" >> $seqres.full
-$here/src/fsync-err $sflag -d $here/src/dmerror $testfile
+$here/src/fsync-err $sflag -d "$here/src/dmerror $seq" $testfile
# success, all done
_dmerror_load_working_table
--
2.45.2
next prev parent reply other threads:[~2024-11-27 4:54 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 ` Dave Chinner [this message]
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 ` [PATCH 28/40] filters: add a filter that accepts EIO instead of other errors Dave Chinner
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-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.