ZTS: Waiting for zvols to be available

This is a follow up patch for PR #12515 which addresses some
additional ZTS tests which are unreliable are should explicitly
wait for the required zvols to be available.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: @Theo13111
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #12553
This commit is contained in:
Brian Behlendorf 2021-09-13 12:18:01 -07:00 committed by Tony Hutter
parent 9183321501
commit 7816a6b85b
4 changed files with 8 additions and 7 deletions

View File

@ -83,25 +83,24 @@ function do_vol_test
vol=$TESTPOOL/$TESTVOL1
vol_b_path=$ZVOL_DEVDIR/$TESTPOOL/$TESTVOL1
vol_r_path=$ZVOL_RDEVDIR/$TESTPOOL/$TESTVOL1
log_must zfs create -V $VOLSIZE -o copies=$copies $vol
log_must zfs set refreservation=none $vol
block_device_wait $vol_r_path
block_device_wait $vol_b_path
case "$type" in
"ext2")
if is_freebsd; then
log_unsupported "ext2 test not implemented for freebsd"
fi
log_must eval "new_fs $vol_r_path >/dev/null 2>&1"
log_must eval "new_fs $vol_b_path >/dev/null 2>&1"
log_must mount -o rw $vol_b_path $mntp
;;
"ufs")
if is_linux; then
log_unsupported "ufs test not implemented for linux"
fi
log_must eval "new_fs $vol_r_path >/dev/null 2>&1"
log_must eval "new_fs $vol_b_path >/dev/null 2>&1"
log_must mount $vol_b_path $mntp
;;
"zfs")

View File

@ -69,7 +69,7 @@ rename_dataset ${vol}-new $vol
clone=$TESTPOOL/${snap}_clone
create_clone $vol@$snap $clone
block_device_wait
block_device_wait $VOLDATA
#verify data integrity
for input in $VOL_R_PATH $ZVOL_RDEVDIR/$clone; do

View File

@ -72,7 +72,7 @@ log_must zfs mount -o ro $POOL_NAME/testfs
old_mntpnt=$(get_prop mountpoint $POOL_NAME/testfs)
log_must eval "ls $old_mntpnt | grep -q testfile"
block_device_wait
block_device_wait /dev/zvol/$POOL_NAME/testvol
log_mustnot dd if=/dev/zero of=/dev/zvol/$POOL_NAME/testvol bs=512 count=1
log_must dd if=/dev/zvol/$POOL_NAME/testvol of=/dev/null bs=512 count=1
@ -90,7 +90,7 @@ log_must eval "zfs send $POOL_NAME/testfs@snap1 | \
zfs recv $POOL_NAME/encroot/testfs"
log_must eval "zfs send $POOL_NAME/testvol@snap1 | \
zfs recv $POOL_NAME/encroot/testvol"
block_device_wait
block_device_wait /dev/zvol/$POOL_NAME/encroot/testvol
log_must dd if=/dev/zero of=/dev/zvol/$POOL_NAME/encroot/testvol bs=512 count=1
new_mntpnt=$(get_prop mountpoint $POOL_NAME/encroot/testfs)
log_must eval "ls $new_mntpnt | grep -q testfile"

View File

@ -107,6 +107,8 @@ log_must zfs create -o mountpoint=none $VOLFS
log_must zfs create -V $VOLSIZE -s $SUBZVOL
log_must zfs create -V $VOLSIZE -s $ZVOL
udev_wait
blockdev_exists $ZDEV
blockdev_exists $SUBZDEV
test_io $ZDEV
test_io $SUBZDEV