Insert small delay for udev

While the zfs utilities do block until the expected device appears
they can only do this for full devices, not partitions.  This means
that once as device appears it still may take a little bit of time
before the kernel rescans the partition table, updates sysfs, udev
is notified and the partition devices are created.  The test case
itself could block briefly waiting for the partition beause it knows
what to expect.  But for now the simpler thing to do is just delay.
This commit is contained in:
Brian Behlendorf 2010-08-09 16:01:44 -07:00
parent 6478a7f847
commit d5168aa089
1 changed files with 5 additions and 2 deletions

View File

@ -186,6 +186,9 @@ zconfig_zvol_device_stat() {
local CLONE_NAME=/dev/$5
local COUNT=0
# Briefly delay for udev
sleep 1
# Pool exists
stat ${POOL_NAME} &>/dev/null && let COUNT=$COUNT+1
@ -245,7 +248,7 @@ zconfig_test4() {
${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 9
# Import the pool, wait 1 second for udev
${ZPOOL} import ${POOL_NAME} && sleep 1 || fail 10
${ZPOOL} import ${POOL_NAME} || fail 10
# Verify the devices were created
zconfig_zvol_device_stat 10 ${POOL_NAME} ${FULL_ZVOL_NAME} \
@ -297,7 +300,7 @@ zconfig_test5() {
${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 9
# Load the modules, wait 1 second for udev
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" && sleep 1 || fail 10
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 10
# Verify the devices were created
zconfig_zvol_device_stat 10 ${POOL_NAME} ${FULL_ZVOL_NAME} \