From: Ming Lei Date: Mon, 30 Aug 2021 02:38:44 +0000 (+0800) Subject: block/001: don't exit test with pending async scan X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=20c53b2189d6c47173fca4932d2432554b302f6d;p=users%2Fhch%2Fblktests.git block/001: don't exit test with pending async scan 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 Signed-off-by: Ming Lei --- diff --git a/tests/block/001 b/tests/block/001 index c26792b..5f05fa8 100755 --- a/tests/block/001 +++ b/tests/block/001 @@ -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