[PATCH 09/40] fstests: per-test dmdelay instances

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Dave Chinner <dchinner@xxxxxxxxxx>

We can't run two tests that use dmdelay at the same time because
the device name is the same. hence they interfere with each other.
Give dmdelay devices their own per-test names to avoid this
problem.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 common/dmdelay | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/common/dmdelay b/common/dmdelay
index 66cac1a70..1c4fca6e9 100644
--- a/common/dmdelay
+++ b/common/dmdelay
@@ -7,13 +7,15 @@
 DELAY_NONE=0
 DELAY_READ=1
 
+export DELAY_NAME="delay-test.$seq"
+
 _init_delay()
 {
 	local BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
-	DELAY_DEV=/dev/mapper/delay-test
+	DELAY_DEV=/dev/mapper/$DELAY_NAME
 	DELAY_TABLE="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 0"
 	DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 10000 $SCRATCH_DEV 0 0"
-	_dmsetup_create delay-test --table "$DELAY_TABLE" || \
+	_dmsetup_create $DELAY_NAME --table "$DELAY_TABLE" || \
 		_fatal "failed to create delay device"
 }
 
@@ -33,9 +35,9 @@ _cleanup_delay()
 {
 	# If dmsetup load fails then we need to make sure to do resume here
 	# otherwise the umount will hang
-	$DMSETUP_PROG resume delay-test > /dev/null 2>&1
+	$DMSETUP_PROG resume $DELAY_NAME > /dev/null 2>&1
 	$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
-	_dmsetup_remove delay-test
+	_dmsetup_remove $DELAY_NAME
 }
 
 # _load_delay_table <table> [lockfs]
@@ -52,15 +54,15 @@ _load_delay_table()
 
 	# run a suspend/resume cycle to avoid excessive resume delays once a
 	# delay is introduced below
-	$DMSETUP_PROG suspend $suspend_opt delay-test
-	$DMSETUP_PROG resume $suspend_opt delay-test
+	$DMSETUP_PROG suspend $suspend_opt $DELAY_NAME
+	$DMSETUP_PROG resume $suspend_opt $DELAY_NAME
 
-	$DMSETUP_PROG suspend $suspend_opt delay-test
+	$DMSETUP_PROG suspend $suspend_opt $DELAY_NAME
 	[ $? -ne 0 ] && _fatal "failed to suspend delay-test"
 
-	$DMSETUP_PROG load delay-test --table "$table"
+	$DMSETUP_PROG load $DELAY_NAME --table "$table"
 	[ $? -ne 0 ] && _fatal "failed to load table into delay-test"
 
-	$DMSETUP_PROG resume delay-test
+	$DMSETUP_PROG resume $DELAY_NAME
 	[ $? -ne 0 ] && _fatal  "failed to resume delay-test"
 }
-- 
2.45.2





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux