Skip to contentSkip to conversation

block/001: don't exit test with pending async scan

PATCH Applied Ming Lei 2 participants 2 messages Aug 30, 2021 – Aug 31, 2021 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 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")
---
 tests/block/001 | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
tests/block/001 +2 -7
index c26792b..be33962 100755
@@ -29,13 +29,8 @@ 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
-				sleep 0.01
-			done
+			while [[ ! -d "/sys/class/scsi_device/${target}" ]]; do sleep 0.01; done
+			echo 1 > "/sys/class/scsi_device/${target}/device/delete"
 		done
 		) &
 	done
Signature · 1 line
2.31.1
#1 lore raw
Quoted 4 lines · Ming Lei

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.'

Quoted 8 lines

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

Fixes f3bcd8c ("block/001: wait until device is added")
---
 tests/block/001 | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Applied, thanks.