ZTS: Waiting for zvols to be available
The ZTS block_device_wait helper function should use -e when waiting for a file to appear since it will be either a block special device or a symlink. This didn't cause any failures but when a device path was specified the function would wait longer than needed. Additionally update the most flakey test cases to pass the file path to block_device_wait to try and improve the test reliability. The udev behavior on Fedora in particular can result in frequent false positives. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #12515
This commit is contained in:
parent
6c3c7dc846
commit
6bb6410570
|
@ -93,7 +93,7 @@ function block_device_wait
|
||||||
typeset missing=false
|
typeset missing=false
|
||||||
typeset dev
|
typeset dev
|
||||||
for dev in "${@}"; do
|
for dev in "${@}"; do
|
||||||
if ! [[ -f $dev ]]; then
|
if ! [[ -e $dev ]]; then
|
||||||
missing=true
|
missing=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -87,7 +87,7 @@ function do_vol_test
|
||||||
|
|
||||||
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
|
block_device_wait $vol_r_path
|
||||||
|
|
||||||
case "$type" in
|
case "$type" in
|
||||||
"ext2")
|
"ext2")
|
||||||
|
|
|
@ -117,26 +117,26 @@ log_must diff $SRC_FILE $obj
|
||||||
if is_global_zone; then
|
if is_global_zone; then
|
||||||
vol=$TESTPOOL/$TESTFS/vol.$$ ; volclone=$TESTPOOL/$TESTFS/volclone.$$
|
vol=$TESTPOOL/$TESTFS/vol.$$ ; volclone=$TESTPOOL/$TESTFS/volclone.$$
|
||||||
log_must zfs create -V 100M $vol
|
log_must zfs create -V 100M $vol
|
||||||
block_device_wait
|
|
||||||
|
|
||||||
obj=$(target_obj $vol)
|
obj=$(target_obj $vol)
|
||||||
|
block_device_wait $obj
|
||||||
log_must dd if=$SRC_FILE of=$obj bs=$BS count=$CNT
|
log_must dd if=$SRC_FILE of=$obj bs=$BS count=$CNT
|
||||||
|
|
||||||
snap=${vol}@snap.$$
|
snap=${vol}@snap.$$
|
||||||
log_must zfs snapshot $snap
|
log_must zfs snapshot $snap
|
||||||
log_must zfs clone $snap $volclone
|
log_must zfs clone $snap $volclone
|
||||||
block_device_wait
|
|
||||||
|
|
||||||
# Rename dataset & clone
|
# Rename dataset & clone
|
||||||
log_must zfs rename $vol ${vol}-new
|
log_must zfs rename $vol ${vol}-new
|
||||||
log_must zfs rename $volclone ${volclone}-new
|
log_must zfs rename $volclone ${volclone}-new
|
||||||
block_device_wait
|
|
||||||
|
|
||||||
# Compare source file and target file
|
# Compare source file and target file
|
||||||
obj=$(target_obj ${vol}-new)
|
obj=$(target_obj ${vol}-new)
|
||||||
|
block_device_wait $obj
|
||||||
log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT
|
log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT
|
||||||
log_must diff $SRC_FILE $DST_FILE
|
log_must diff $SRC_FILE $DST_FILE
|
||||||
obj=$(target_obj ${volclone}-new)
|
obj=$(target_obj ${volclone}-new)
|
||||||
|
block_device_wait $obj
|
||||||
log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT
|
log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT
|
||||||
log_must diff $SRC_FILE $DST_FILE
|
log_must diff $SRC_FILE $DST_FILE
|
||||||
|
|
||||||
|
@ -144,10 +144,10 @@ if is_global_zone; then
|
||||||
log_must zfs rename ${vol}-new $vol
|
log_must zfs rename ${vol}-new $vol
|
||||||
log_must zfs rename $snap ${snap}-new
|
log_must zfs rename $snap ${snap}-new
|
||||||
log_must zfs clone ${snap}-new $volclone
|
log_must zfs clone ${snap}-new $volclone
|
||||||
block_device_wait
|
|
||||||
|
|
||||||
# Compare source file and target file
|
# Compare source file and target file
|
||||||
obj=$(target_obj $volclone)
|
obj=$(target_obj $volclone)
|
||||||
|
block_device_wait $obj
|
||||||
log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT
|
log_must dd if=$obj of=$DST_FILE bs=$BS count=$CNT
|
||||||
log_must diff $SRC_FILE $DST_FILE
|
log_must diff $SRC_FILE $DST_FILE
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -52,7 +52,7 @@ log_must eval "bzcat <$sendfile_compressed >$sendfile"
|
||||||
log_must eval "zstream redup $sendfile | zfs recv $TESTPOOL/recv"
|
log_must eval "zstream redup $sendfile | zfs recv $TESTPOOL/recv"
|
||||||
|
|
||||||
log_must zfs load-key $TESTPOOL/recv
|
log_must zfs load-key $TESTPOOL/recv
|
||||||
block_device_wait
|
block_device_wait $volfile
|
||||||
|
|
||||||
log_must eval "bzcat <$volfile_compressed >$volfile"
|
log_must eval "bzcat <$volfile_compressed >$volfile"
|
||||||
log_must diff $volfile $recvdev
|
log_must diff $volfile $recvdev
|
||||||
|
|
|
@ -65,7 +65,7 @@ for compress in "${compress_prop_vals[@]}"; do
|
||||||
datasetexists $send_vol && log_must_busy zfs destroy -r $send_vol
|
datasetexists $send_vol && log_must_busy zfs destroy -r $send_vol
|
||||||
log_must zfs create -o compress=$compress $send_ds
|
log_must zfs create -o compress=$compress $send_ds
|
||||||
log_must zfs create -V 1g -o compress=$compress $send_vol
|
log_must zfs create -V 1g -o compress=$compress $send_vol
|
||||||
block_device_wait
|
block_device_wait $send_voldev
|
||||||
|
|
||||||
typeset dir=$(get_prop mountpoint $send_ds)
|
typeset dir=$(get_prop mountpoint $send_ds)
|
||||||
log_must cp $file $dir
|
log_must cp $file $dir
|
||||||
|
|
|
@ -62,7 +62,7 @@ for vbs in 8192 16384 32768 65536 131072; do
|
||||||
|
|
||||||
# Create a sparse volume to test larger sizes
|
# Create a sparse volume to test larger sizes
|
||||||
log_must zfs create -s -b $vbs -V $volsize $vol
|
log_must zfs create -s -b $vbs -V $volsize $vol
|
||||||
block_device_wait
|
block_device_wait $swapname
|
||||||
log_must swap_setup $swapname
|
log_must swap_setup $swapname
|
||||||
|
|
||||||
new_volsize=$(get_prop volsize $vol)
|
new_volsize=$(get_prop volsize $vol)
|
||||||
|
|
Loading…
Reference in New Issue