All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: scsi_transport_srp: don't block target in failfast state
@ 2021-01-11 14:25 mwilck
  2021-01-12  4:38 ` Bart Van Assche
  2021-01-13  5:48 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: mwilck @ 2021-01-11 14:25 UTC (permalink / raw)
  To: Martin K. Petersen, Hannes Reinecke
  Cc: Bart Van Assche, linux-scsi, James Bottomley, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

If the port is in SRP_RPORT_FAIL_FAST state when srp_reconnect_rport()
is entered, a transition to SDEV_BLOCK would be illegal, and a kernel
WARNING would be triggered. Skip scsi_target_block() in this case.

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

diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
index cba1cf6a1c12..1e939a2a387f 100644
--- a/drivers/scsi/scsi_transport_srp.c
+++ b/drivers/scsi/scsi_transport_srp.c
@@ -541,7 +541,14 @@ int srp_reconnect_rport(struct srp_rport *rport)
 	res = mutex_lock_interruptible(&rport->mutex);
 	if (res)
 		goto out;
-	scsi_target_block(&shost->shost_gendev);
+	if (rport->state != SRP_RPORT_FAIL_FAST)
+		/*
+		 * sdev state must be SDEV_TRANSPORT_OFFLINE, transition
+		 * to SDEV_BLOCK is illegal. Calling scsi_target_unblock()
+		 * later is ok though, scsi_internal_device_unblock_nowait()
+		 * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK.
+		 */
+		scsi_target_block(&shost->shost_gendev);
 	res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV;
 	pr_debug("%s (state %d): transport.reconnect() returned %d\n",
 		 dev_name(&shost->shost_gendev), rport->state, res);
-- 
2.29.2


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

end of thread, other threads:[~2021-01-13  5:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 14:25 [PATCH] scsi: scsi_transport_srp: don't block target in failfast state mwilck
2021-01-12  4:38 ` Bart Van Assche
2021-01-13  5:48 ` 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.