linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block/001: don't exit test with pending async scan
@ 2021-08-30  2:38 Ming Lei
  2021-08-31 23:42 ` Omar Sandoval
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2021-08-30  2:38 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-block, Ming Lei, Yi Zhang

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 | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/tests/block/001 b/tests/block/001
index c26792b..be33962 100755
--- a/tests/block/001
+++ b/tests/block/001
@@ -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
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block/001: don't exit test with pending async scan
  2021-08-30  2:38 [PATCH] block/001: don't exit test with pending async scan Ming Lei
@ 2021-08-31 23:42 ` Omar Sandoval
  0 siblings, 0 replies; 2+ messages in thread
From: Omar Sandoval @ 2021-08-31 23:42 UTC (permalink / raw)
  To: Ming Lei; +Cc: Omar Sandoval, linux-block, Yi Zhang

On Mon, Aug 30, 2021 at 10:38:44AM +0800, Ming Lei wrote:
> 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 | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-31 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30  2:38 [PATCH] block/001: don't exit test with pending async scan Ming Lei
2021-08-31 23:42 ` Omar Sandoval

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).