]> www.infradead.org Git - users/hch/blktests.git/commitdiff
tests/nvmeof-mp/rc: Make simulate_network_failure_loop() more robust
authorBart Van Assche <bvanassche@acm.org>
Thu, 8 Aug 2019 20:05:04 +0000 (13:05 -0700)
committerOmar Sandoval <osandov@osandov.com>
Wed, 4 Sep 2019 17:49:18 +0000 (10:49 -0700)
Avoid that the following is logged in the nvmeof-mp .full log files:

ls: cannot access '/sys/class/nvme/*/device/*/nvme0n1/reset_controller': No such
file or directory
tests/nvmeof-mp/rc: line 124: : No such file or directory

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
tests/nvmeof-mp/rc

index 9324dd1e8e4f74859b743db4eab98ddced5c1b54..7352b1628cd3834fdf4f4217e87294a70b1b4edb 100755 (executable)
@@ -117,8 +117,9 @@ simulate_network_failure_loop() {
        while [ $rc = 0 ]; do
                sleep_until 5 ${deadline} || break
                for d in $(held_by "$dev"); do
-                       sf=$(ls -d /sys/class/nvme/*/device/*/"${d#/dev/}/reset_controller")
-                       echo 1 > "$sf"
+                       for sf in /sys/class/nvme/*/device/*/"${d#/dev/}/reset_controller"; do
+                               [ -e "$sf" ] && echo 1 > "$sf"
+                       done
                done
        done 2>>"$FULL"