From 3f015ca7a335c4523bc700fc54143425a1a8a7d2 Mon Sep 17 00:00:00 2001 From: Serapheim Dimitropoulos Date: Thu, 6 Oct 2022 10:29:29 -0700 Subject: [PATCH] zvol_wait logic may terminate prematurely Setups that have a lot of zvols may see zvol_wait terminate prematurely even though the script is still making progress. For example, we have a customer that called zvol_wait for ~7100 zvols and by the last iteration of that script it was still waiting on ~2900. Similarly another one called zvol_wait for 2200 and by the time the script terminated there were only 50 left. This patch adjusts the logic to stay within the outer loop of the script if we are making any progress whatsoever. Signed-off-by: Serapheim Dimitropoulos --- cmd/zvol_wait | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/zvol_wait b/cmd/zvol_wait index f1fa42e27dc9..0b2a8a3e60c3 100755 --- a/cmd/zvol_wait +++ b/cmd/zvol_wait @@ -109,6 +109,13 @@ while [ "$outer_loop" -lt 20 ]; do exit 0 fi fi + + # + # zvol_count made some progress - let's stay in this loop. + # + if [ "$old_zvols_count" -gt "$zvols_count" ]; then + outer_loop=$((outer_loop - 1)) + fi done echo "Timed out waiting on zvol links"