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 GitHub
parent b9ec4a15e5
commit 695d4ae815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 7 deletions

View File

@ -83,25 +83,24 @@ function do_vol_test
vol=$TESTPOOL/$TESTVOL1 vol=$TESTPOOL/$TESTVOL1
vol_b_path=$ZVOL_DEVDIR/$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 create -V $VOLSIZE -o copies=$copies $vol
log_must zfs set refreservation=none $vol log_must zfs set refreservation=none $vol
block_device_wait $vol_r_path block_device_wait $vol_b_path
case "$type" in case "$type" in
"ext2") "ext2")
if is_freebsd; then if is_freebsd; then
log_unsupported "ext2 test not implemented for freebsd" log_unsupported "ext2 test not implemented for freebsd"
fi 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 log_must mount -o rw $vol_b_path $mntp
;; ;;
"ufs") "ufs")
if is_linux; then if is_linux; then
log_unsupported "ufs test not implemented for linux" log_unsupported "ufs test not implemented for linux"
fi 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 log_must mount $vol_b_path $mntp
;; ;;
"zfs") "zfs")

View File

@ -69,7 +69,7 @@ rename_dataset ${vol}-new $vol
clone=$TESTPOOL/${snap}_clone clone=$TESTPOOL/${snap}_clone
create_clone $vol@$snap $clone create_clone $vol@$snap $clone
block_device_wait block_device_wait $VOLDATA
#verify data integrity #verify data integrity
for input in $VOL_R_PATH $ZVOL_RDEVDIR/$clone; do 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) old_mntpnt=$(get_prop mountpoint $POOL_NAME/testfs)
log_must eval "ls $old_mntpnt | grep -q testfile" 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_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 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" zfs recv $POOL_NAME/encroot/testfs"
log_must eval "zfs send $POOL_NAME/testvol@snap1 | \ log_must eval "zfs send $POOL_NAME/testvol@snap1 | \
zfs recv $POOL_NAME/encroot/testvol" 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 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) new_mntpnt=$(get_prop mountpoint $POOL_NAME/encroot/testfs)
log_must eval "ls $new_mntpnt | grep -q testfile" 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 $SUBZVOL
log_must zfs create -V $VOLSIZE -s $ZVOL log_must zfs create -V $VOLSIZE -s $ZVOL
udev_wait udev_wait
blockdev_exists $ZDEV
blockdev_exists $SUBZDEV
test_io $ZDEV test_io $ZDEV
test_io $SUBZDEV test_io $SUBZDEV