diff mbox series

[08/40] fstests: per-test dmdust instances

Message ID 20241127045403.3665299-9-david@fromorbit.com (mailing list archive)
State New
Headers show
Series fstests: concurrent test execution | expand

Commit Message

Dave Chinner Nov. 27, 2024, 4:51 a.m. UTC
From: Dave Chinner <dchinner@redhat.com>

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

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 common/dmdust | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/common/dmdust b/common/dmdust
index 56fcc0e0f..37bb865c8 100644
--- a/common/dmdust
+++ b/common/dmdust
@@ -4,12 +4,14 @@ 
 #
 # common functions for setting up and tearing down a dmdust device
 
+export DUST_NAME="dust-test.$seq"
+
 _init_dust()
 {
 	local DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
-	DUST_DEV=/dev/mapper/dust-test
+	DUST_DEV=/dev/mapper/$DUST_NAME
 	DUST_TABLE="0 $DEV_SIZE dust $SCRATCH_DEV 0 512"
-	_dmsetup_create dust-test --table "$DUST_TABLE" || \
+	_dmsetup_create $DUST_NAME --table "$DUST_TABLE" || \
 		_fatal "failed to create dust device"
 }
 
@@ -29,7 +31,7 @@  _cleanup_dust()
 {
 	# If dmsetup load fails then we need to make sure to do resume here
 	# otherwise the umount will hang
-	$DMSETUP_PROG resume dust-test > /dev/null 2>&1
+	$DMSETUP_PROG resume $DUST_NAME > /dev/null 2>&1
 	$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
-	_dmsetup_remove dust-test
+	_dmsetup_remove $DUST_NAME
 }