Skip to content

Commit f3bcd8c

Browse files
Ming Leiosandov
authored andcommitted
block/001: wait until device is added
Writing to the scan attribute of scsi host is usually one sync scan, but devices in this sync scan may be delay added if there is concurrent asnyc scan. So wait until the device is added in block/001 for avoiding to fail the test. Cc: "Martin K. Petersen" <[email protected]> Cc: [email protected] Signed-off-by: Ming Lei <[email protected]> [Omar: fix quoting and simplify logic] Signed-off-by: Omar Sandoval <[email protected]>
1 parent ead3f78 commit f3bcd8c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tests/block/001

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ stress_scsi_debug() {
2929
scan="${scan//:/ }"
3030
while [[ ! -e "$TMPDIR/stop" ]]; do
3131
echo "${scan}" > "/sys/class/scsi_host/host${host}/scan"
32-
echo 1 > "/sys/class/scsi_device/${target}/device/delete"
32+
while [[ ! -e "$TMPDIR/stop" ]]; do
33+
if [[ -d "/sys/class/scsi_device/${target}" ]]; then
34+
echo 1 > "/sys/class/scsi_device/${target}/device/delete"
35+
break
36+
fi
37+
sleep 0.01
38+
done
3339
done
3440
) &
3541
done

0 commit comments

Comments
 (0)