From c8b3dda18638fca8b0cc580ad7cecf410606e646 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 9 May 2023 08:57:02 -0700 Subject: [PATCH] Debug auto_replace_001_pos failures Reduced the timeout to 60 seconds which should be more than sufficient and allow the test to be marked as FAILED rather than KILLED. Also dump the pool status on cleanup. Reviewed-by: Brian Atkinson Signed-off-by: Brian Behlendorf Closes #14829 --- tests/zfs-tests/include/libtest.shlib | 14 +++++++++++--- .../functional/fault/auto_replace_001_pos.ksh | 5 +++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 02e6a500a..8521f271b 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -1951,6 +1951,7 @@ function check_pool_status # pool token keyword # is_pool_removing - to check if the pool removing is a vdev # is_pool_removed - to check if the pool remove is completed # is_pool_discarding - to check if the pool checkpoint is being discarded +# is_pool_replacing - to check if the pool is performing a replacement # function is_pool_resilvering #pool { @@ -1997,6 +1998,10 @@ function is_pool_discarding #pool { check_pool_status "$1" "checkpoint" "discarding" } +function is_pool_replacing #pool +{ + zpool status "$1" | grep -qE 'replacing-[0-9]+' +} function wait_for_degraded { @@ -2983,12 +2988,15 @@ function wait_freeing #pool # Wait for every device replace operation to complete # # $1 pool name +# $2 timeout # -function wait_replacing #pool +function wait_replacing #pool timeout { + typeset timeout=${2:-300} typeset pool=${1:-$TESTPOOL} - while zpool status $pool | grep -qE 'replacing-[0-9]+'; do - log_must sleep 1 + for (( timer = 0; timer < $timeout; timer++ )); do + is_pool_replacing $pool || break; + sleep 1; done } diff --git a/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh b/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh index 2846192d0..081e6c184 100755 --- a/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh @@ -54,6 +54,7 @@ fi function cleanup { + zpool status $TESTPOOL destroy_pool $TESTPOOL sed -i '/alias scsidebug/d' $VDEVID_CONF unload_scsi_debug @@ -99,8 +100,8 @@ block_device_wait insert_disk $SD $SD_HOST # Wait for the new disk to be online and replaced -log_must wait_vdev_state $TESTPOOL "scsidebug" "ONLINE" $MAXTIMEOUT -log_must wait_replacing $TESTPOOL +log_must wait_vdev_state $TESTPOOL "scsidebug" "ONLINE" 60 +log_must wait_replacing $TESTPOOL 60 # Validate auto-replace was successful log_must check_state $TESTPOOL "" "ONLINE"