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 <eguan@redhat.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Eryu Guan
2016-04-05 11:44:33 +10:00
committed by Dave Chinner
parent 450d833eba
commit 3bc4c5895c
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -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
}
+3
View File
@@ -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
}