]> www.infradead.org Git - users/hch/blktests.git/commitdiff
tests/nvme/rc: Fix possible endless loop
authorLi Zhijian <lizhijian@fujitsu.com>
Tue, 17 May 2022 06:22:35 +0000 (14:22 +0800)
committerOmar Sandoval <osandov@osandov.com>
Tue, 17 May 2022 23:43:49 +0000 (16:43 -0700)
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 <lizhijian@fujitsu.com>
tests/nvme/rc

index 3c38408a0bfe3808c9250887a607c068196c0d86..ff8c627399c8a7d2ccb20cf3563d3d7bca2b8055 100644 (file)
@@ -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