Skip to contentSkip to conversation

common: run mknodes after creating/removing dm targets

PATCH New David Sterba 1 participant 1 message Jun 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: run mknodes after creating/removing dm targets

The command 'dmsetup mknodes' updates the device nodes so they match the configured targets. This is also done by the device managers but in case such service does not run, the devices may not exist. This was observed in a minimal testing VM, some of the tests reported that dm-thin targets do not exist.

Adding the mknodes command after the respective dmsetup commands fixes that. This is already present in eg. dmflakey target setup, this patch adds it to the remainig target setup helpers.

---
 common/dmerror    | 2 ++
 common/dmhugedisk | 2 ++
 common/dmthin     | 3 ++-
 3 files changed, 6 insertions(+), 1 deletion(-)
common/dmerror +2 -0
index 4d6b8851b120..ad825479a804 100644
@@ -28,6 +28,7 @@ _dmerror_init()
 	$DMSETUP_PROG remove error-test > /dev/null 2>&1
 	$DMSETUP_PROG create error-test --table "$DMLINEAR_TABLE" || \
 		_fatal "failed to create dm linear device"
+	$DMSETUP_PROG mknodes > /dev/null 2>&1
 }
 
 _dmerror_mount()
@@ -49,6 +50,7 @@ _dmerror_cleanup()
 	# fail due to EBUSY
 	$UDEV_SETTLE_PROG >/dev/null 2>&1
 	$DMSETUP_PROG remove error-test > /dev/null 2>&1
+	$DMSETUP_PROG mknodes > /dev/null 2>&1
 }
 
 _dmerror_load_error_table()
common/dmhugedisk +2 -0
index 4d0406d617c8..e94423e2c5a2 100644
@@ -35,6 +35,7 @@ _dmhugedisk_init()
 		_fatal "failed to create dm huge zero device"
 	$DMSETUP_PROG create huge-test --table "$DMHUGEDISK_DEV_TABLE" || \
 		_fatal "failed to create dm huge device"
+	$DMSETUP_PROG mknodes > /dev/null 2>&1
 }
 
 _dmhugedisk_cleanup()
@@ -45,4 +46,5 @@ _dmhugedisk_cleanup()
 	$UDEV_SETTLE_PROG >/dev/null 2>&1
 	$DMSETUP_PROG remove huge-test > /dev/null 2>&1
 	$DMSETUP_PROG remove huge-test-zero > /dev/null 2>&1
+	$DMSETUP_PROG mknodes > /dev/null 2>&1
 }
common/dmthin +2 -1
index 039d63e2397a..07e191c7d070 100644
@@ -36,6 +36,7 @@ _dmthin_cleanup()
 	$DMSETUP_PROG remove $DMTHIN_POOL_NAME> /dev/null 2>&1
 	$DMSETUP_PROG remove $DMTHIN_META_NAME> /dev/null 2>&1
 	$DMSETUP_PROG remove $DMTHIN_DATA_NAME> /dev/null 2>&1
+	$DMSETUP_PROG mknodes > /dev/null 2>&1
 }
 
 _dmthin_check_fs()
@@ -138,7 +139,7 @@ _dmthin_init()
 	DMTHIN_VOL_TABLE="0 $virtual_size thin $DMTHIN_POOL_DEV $pool_id"
 	$DMSETUP_PROG create $DMTHIN_VOL_NAME --table "$DMTHIN_VOL_TABLE" || \
 		_fatal "failed to create dm thin volume device"
-
+	$DMSETUP_PROG mknodes > /dev/null 2>&1
 }
 
 # for internal use
Signature · 1 line
2.17.0