All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] scsi_debug: reset injection flags for every_nth > 0
       [not found] <20180205141740.32418-1-mwilck@suse.com>
@ 2018-02-05 14:17 ` Martin Wilck
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Wilck @ 2018-02-05 14:17 UTC (permalink / raw)
  To: Martin K. Petersen, Douglas Gilbert, Hannes Reinecke
  Cc: James Bottomley, linux-scsi, Martin Wilck

If every_nth > 0, the injection flags must be reset for commands
that aren't supposed to fail (i.e. that aren't "nth"). Otherwise,
commands will continue to fail, like in the every_nth < 0 case.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 drivers/scsi/scsi_debug.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 86c48797381e..820b98853e69 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3988,8 +3988,13 @@ static void clear_queue_stats(void)
 static void setup_inject(struct sdebug_queue *sqp,
 			 struct sdebug_queued_cmd *sqcp)
 {
-	if ((atomic_read(&sdebug_cmnd_count) % abs(sdebug_every_nth)) > 0)
+	if ((atomic_read(&sdebug_cmnd_count) % abs(sdebug_every_nth)) > 0) {
+		if (sdebug_every_nth > 0)
+			sqcp->inj_recovered = sqcp->inj_transport
+				= sqcp->inj_dif
+				= sqcp->inj_dix = sqcp->inj_short = 0;
 		return;
+	}
 	sqcp->inj_recovered = !!(SDEBUG_OPT_RECOVERED_ERR & sdebug_opts);
 	sqcp->inj_transport = !!(SDEBUG_OPT_TRANSPORT_ERR & sdebug_opts);
 	sqcp->inj_dif = !!(SDEBUG_OPT_DIF_ERR & sdebug_opts);
-- 
2.16.1

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

* Re: [PATCH 2/2] scsi_debug: reset injection flags for every_nth > 0
  2018-01-29 23:35 ` Martin Wilck
@ 2018-02-14  2:49   ` Martin K. Petersen
  0 siblings, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2018-02-14  2:49 UTC (permalink / raw)
  To: Martin Wilck
  Cc: Martin K. Petersen, Douglas Gilbert, Hannes Reinecke,
	James Bottomley, linux-scsi


Martin,

> If every_nth > 0, the injection flags must be reset for commands
> that aren't supposed to fail (i.e. that aren't "nth"). Otherwise,
> commands will continue to fail, like in the every_nth < 0 case.

Applied to 4.17/scsi-queue.

Please rebase patch 1/2. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* [PATCH 2/2] scsi_debug: reset injection flags for every_nth > 0
       [not found] <20180129233552.26702-1-mwilck@suse.com>
@ 2018-01-29 23:35 ` Martin Wilck
  2018-02-14  2:49   ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Wilck @ 2018-01-29 23:35 UTC (permalink / raw)
  To: Martin K. Petersen, Douglas Gilbert, Hannes Reinecke
  Cc: James Bottomley, linux-scsi

If every_nth > 0, the injection flags must be reset for commands
that aren't supposed to fail (i.e. that aren't "nth"). Otherwise,
commands will continue to fail, like in the every_nth < 0 case.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 drivers/scsi/scsi_debug.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 86c48797381e..820b98853e69 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3988,8 +3988,13 @@ static void clear_queue_stats(void)
 static void setup_inject(struct sdebug_queue *sqp,
 			 struct sdebug_queued_cmd *sqcp)
 {
-	if ((atomic_read(&sdebug_cmnd_count) % abs(sdebug_every_nth)) > 0)
+	if ((atomic_read(&sdebug_cmnd_count) % abs(sdebug_every_nth)) > 0) {
+		if (sdebug_every_nth > 0)
+			sqcp->inj_recovered = sqcp->inj_transport
+				= sqcp->inj_dif
+				= sqcp->inj_dix = sqcp->inj_short = 0;
 		return;
+	}
 	sqcp->inj_recovered = !!(SDEBUG_OPT_RECOVERED_ERR & sdebug_opts);
 	sqcp->inj_transport = !!(SDEBUG_OPT_TRANSPORT_ERR & sdebug_opts);
 	sqcp->inj_dif = !!(SDEBUG_OPT_DIF_ERR & sdebug_opts);
-- 
2.16.1

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

end of thread, other threads:[~2018-02-14  2:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180205141740.32418-1-mwilck@suse.com>
2018-02-05 14:17 ` [PATCH 2/2] scsi_debug: reset injection flags for every_nth > 0 Martin Wilck
     [not found] <20180129233552.26702-1-mwilck@suse.com>
2018-01-29 23:35 ` Martin Wilck
2018-02-14  2:49   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.