common: make sure dm device is all settled before removing it
authorEryu Guan <eguan@redhat.com>
Tue, 5 Apr 2016 01:44:33 +0000 (11:44 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 5 Apr 2016 01:44:33 +0000 (11:44 +1000)
_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>
common/dmerror
common/dmflakey

index 004530dd3175f676b92fe26d286aa7e5dd8a7aea..5d2c1b68bcc09c040a82d547f0cb5654f8628035 100644 (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
 }
 
index 3b6521a017d233f437d6f0df3e5beb1fd295d2f7..4434307ea713d47d091e27ccf8ce0e2415a78f7d 100644 (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
 }