[v1,1/2] common/dmthin: call $UDEV_SETTLE_PROG before 'dmsetup remove'
diff mbox

Message ID 1484718510-7433-1-git-send-email-bxue@redhat.com
State New
Headers show

Commit Message

bxue@redhat.com Jan. 18, 2017, 5:48 a.m. UTC
From: Boyang Xue <bxue@redhat.com>

Wait for device to be fully settled so that 'dmsetup remove' doesn't
fail due to EBUSY.

Signed-off-by: Boyang Xue <bxue@redhat.com>
---
 common/dmthin | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox

diff --git a/common/dmthin b/common/dmthin
index 3cd206a..e774175 100644
--- a/common/dmthin
+++ b/common/dmthin
@@ -38,6 +38,9 @@  DMTHIN_VOL_DEV="/dev/mapper/$DMTHIN_VOL_NAME"
 _dmthin_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 $DMTHIN_VOL_NAME> /dev/null 2>&1
 	$DMSETUP_PROG remove $DMTHIN_POOL_NAME> /dev/null 2>&1
 	$DMSETUP_PROG remove $DMTHIN_META_NAME> /dev/null 2>&1