From: Eryu Guan Date: Tue, 5 Apr 2016 01:44:33 +0000 (+1000) Subject: common: make sure dm device is all settled before removing it X-Git-Tag: v2022.05.01~2552 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3bc4c5895c977c44a9e9bc29296a2f1b679c2fc7;p=users%2Fhch%2Fxfstests-dev.git common: make sure dm device is all settled before removing it _dmerror_cleanup()/_cleanup_flakey may fail to remove dm device due to EBUSY and cause subsequent tests to fail. Fix it by calling $UDEV_SETTLE_PROG before remove dm device to make sure no one is using it. Signed-off-by: Eryu Guan Reviewed-by: Filipe Manana Signed-off-by: Dave Chinner --- diff --git a/common/dmerror b/common/dmerror index 004530dd3..5d2c1b68b 100644 --- a/common/dmerror +++ b/common/dmerror @@ -54,6 +54,9 @@ _dmerror_unmount() _dmerror_cleanup() { $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1 + # wait for device to be fully settled so that 'dmsetup remove' doesn't + # fail due to EBUSY + $UDEV_SETTLE_PROG >/dev/null 2>&1 $DMSETUP_PROG remove error-test > /dev/null 2>&1 } diff --git a/common/dmflakey b/common/dmflakey index 3b6521a01..4434307ea 100644 --- a/common/dmflakey +++ b/common/dmflakey @@ -54,6 +54,9 @@ _cleanup_flakey() # otherwise the umount will hang $DMSETUP_PROG resume flakey-test > /dev/null 2>&1 $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1 + # wait for device to be fully settled so that 'dmsetup remove' doesn't + # fail due to EBUSY + $UDEV_SETTLE_PROG >/dev/null 2>&1 $DMSETUP_PROG remove flakey-test > /dev/null 2>&1 $DMSETUP_PROG mknodes > /dev/null 2>&1 }