]> www.infradead.org Git - users/hch/blktests.git/commitdiff
block/001: don't exit test with pending async scan
authorMing Lei <ming.lei@redhat.com>
Mon, 30 Aug 2021 02:38:44 +0000 (10:38 +0800)
committerOmar Sandoval <osandov@fb.com>
Tue, 31 Aug 2021 23:42:37 +0000 (16:42 -0700)
We have to run scan and delete together, otherwise pending async
may prevent scsi_debug from being unloaded, and cause failure of
'modprobe: FATAL: Module scsi_debug is in use.'

Fix the issue by always running both scan and delete together.

Fixes: f3bcd8c ("block/001: wait until device is added")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
tests/block/001

index c26792bb458e8157fc8f5de1e27c26dd62d39879..5f05fa8c380f861f0a39024e2810e13b9c9171a3 100755 (executable)
@@ -29,13 +29,10 @@ stress_scsi_debug() {
                scan="${scan//:/ }"
                while [[ ! -e "$TMPDIR/stop" ]]; do
                        echo "${scan}" > "/sys/class/scsi_host/host${host}/scan"
-                       while [[ ! -e "$TMPDIR/stop" ]]; do
-                               if [[ -d "/sys/class/scsi_device/${target}" ]]; then
-                                       echo 1 > "/sys/class/scsi_device/${target}/device/delete"
-                                       break
-                               fi
+                       while [[ ! -d "/sys/class/scsi_device/${target}" ]]; do
                                sleep 0.01
                        done
+                       echo 1 > "/sys/class/scsi_device/${target}/device/delete"
                done
                ) &
        done