[PATCH 06/40] fstests: per-test dmhuge 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 dmhuge at the same time because
the device name is the same. hence they interfere with each other.
Give dmhuge devices their own per-test names to avoid this
problem.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 common/dmhugedisk | 19 +++++++++++--------
 tests/generic/620 |  1 +
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/common/dmhugedisk b/common/dmhugedisk
index 502f02437..0757e1908 100644
--- a/common/dmhugedisk
+++ b/common/dmhugedisk
@@ -4,6 +4,9 @@
 #
 # Routines for creating huge (fake) disks
 
+export DMHUGE_TEST="huge-test.$seq"
+export DMHUGE_TEST_ZERO="huge-test-zero.$seq"
+
 _require_dmhugedisk()
 {
 	_require_dm_target zero
@@ -20,26 +23,26 @@ _dmhugedisk_init()
 		chunk_size=512
 	fi
 
-	_dmsetup_remove huge-test
-	_dmsetup_remove huge-test-zero
+	_dmsetup_remove $DMHUGE_TEST
+	_dmsetup_remove $DMHUGE_TEST_ZERO
 
 	local blk_dev_size=$1
 
-	DMHUGEDISK_ZERO='/dev/mapper/huge-test-zero'
-	DMHUGEDISK_DEV='/dev/mapper/huge-test'
+	DMHUGEDISK_ZERO="/dev/mapper/$DMHUGE_TEST_ZERO"
+	DMHUGEDISK_DEV="/dev/mapper/$DMHUGE_TEST"
 
 	DMHUGEDISK_ZERO_TABLE="0 $blk_dev_size zero"
 	DMHUGEDISK_DEV_TABLE="0 $blk_dev_size snapshot $DMHUGEDISK_ZERO $SCRATCH_DEV N $chunk_size"
 
-	_dmsetup_create huge-test-zero --table "$DMHUGEDISK_ZERO_TABLE" || \
+	_dmsetup_create $DMHUGE_TEST_ZERO --table "$DMHUGEDISK_ZERO_TABLE" || \
 		_fatal "failed to create dm huge zero device"
-	_dmsetup_create huge-test --table "$DMHUGEDISK_DEV_TABLE" || \
+	_dmsetup_create $DMHUGE_TEST --table "$DMHUGEDISK_DEV_TABLE" || \
 		_fatal "failed to create dm huge device"
 }
 
 _dmhugedisk_cleanup()
 {
 	$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
-	_dmsetup_remove huge-test
-	_dmsetup_remove huge-test-zero
+	_dmsetup_remove $DMHUGE_TEST
+	_dmsetup_remove $DMHUGE_TEST_ZERO
 }
diff --git a/tests/generic/620 b/tests/generic/620
index bf97328d1..3f1ce45a5 100755
--- a/tests/generic/620
+++ b/tests/generic/620
@@ -47,6 +47,7 @@ testfile=$SCRATCH_MNT/testfile-$seq
 
 $XFS_IO_PROG -fc "pwrite -S 0xaa 0 1m" -c "fsync" $testfile | _filter_xfs_io
 
+_dmhugedisk_cleanup
 # success, all done
 status=0
 exit
-- 
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