From: Hangbin Liu <liuhangbin@xxxxxxxxx> commit fc836129f708407502632107e58d48f54b1caf75 upstream. The busywait timeout value is a millisecond, not a second. So the current setting 2 is too small. On slow/busy host (or VMs) the current timeout can expire even on "correct" execution, causing random failures. Let's copy the WAIT_TIMEOUT from forwarding/lib.sh and set BUSYWAIT_TIMEOUT here. Fixes: 25ae948b4478 ("selftests/net: add lib.sh") Signed-off-by: Hangbin Liu <liuhangbin@xxxxxxxxx> Reviewed-by: Simon Horman <horms@xxxxxxxxxx> Link: https://lore.kernel.org/r/20240124061344.1864484-1-liuhangbin@xxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/net/lib.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -4,6 +4,9 @@ ############################################################################## # Defines +WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} +BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms + # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 # namespace list created by setup_ns @@ -48,7 +51,7 @@ cleanup_ns() for ns in "$@"; do ip netns delete "${ns}" &> /dev/null - if ! busywait 2 ip netns list \| grep -vq "^$ns$" &> /dev/null; then + if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then echo "Warn: Failed to remove namespace $ns" ret=1 fi Patches currently in stable-queue which might be from liuhangbin@xxxxxxxxx are queue-6.6/selftests-net-add-lib.sh.patch queue-6.6/selftests-net-lib-support-errexit-with-busywait.patch queue-6.6/selftests-net-lib-no-need-to-record-ns-name-if-it-already-exist.patch queue-6.6/selftests-net-add-variable-ns_list-for-lib.sh.patch queue-6.6/selftests-forwarding-avoid-failures-to-source-net-lib.sh.patch queue-6.6/selftests-net-lib-update-busywait-timeout-value.patch queue-6.6/selftests-net-lib-avoid-error-removing-empty-netns-name.patch