From: Li Zhijian Date: Tue, 17 May 2022 06:22:35 +0000 (+0800) Subject: tests/nvme/rc: Fix possible endless loop X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=efdc8a60985bad0324e2265356b3a292514f72a7;p=users%2Fhch%2Fblktests.git tests/nvme/rc: Fix possible endless loop A failed connection will cause the later endless loop, so we should return directly in such case. 344 _nvmet_passthru_target_connect() { 345 local trtype=$1 346 local subsys_name=$2 347 348 _nvme_connect_subsys "${trtype}" "${subsys_name}" || return 349 nsdev=$(_find_nvme_passthru_loop_dev "${subsys_name}") 350 351 # The following tests can race with the creation 352 # of the device so ensure the block device exists 353 # before continuing 354 while [ ! -b "${nsdev}" ]; do sleep 1; done <<< endless loop 355 356 echo "${nsdev}" 357 } Signed-off-by: Li Zhijian --- diff --git a/tests/nvme/rc b/tests/nvme/rc index 3c38408..ff8c627 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -345,7 +345,7 @@ _nvmet_passthru_target_connect() { local trtype=$1 local subsys_name=$2 - _nvme_connect_subsys "${trtype}" "${subsys_name}" + _nvme_connect_subsys "${trtype}" "${subsys_name}" || return nsdev=$(_find_nvme_passthru_loop_dev "${subsys_name}") # The following tests can race with the creation