]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fstests: per-test dmdust instances
authorDave Chinner <dchinner@redhat.com>
Tue, 26 Nov 2024 20:41:49 +0000 (07:41 +1100)
committerZorro Lang <zlang@kernel.org>
Sun, 8 Dec 2024 14:04:42 +0000 (22:04 +0800)
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>
Reviewed-by: Zorro lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/dmdust

index 56fcc0e0fffa1e3380d14abd8f4543010817d637..37bb865c8197cd0b77def04652776167868e0066 100644 (file)
@@ -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
 }