Skip to content

Commit 72eeb7c

Browse files
mwilckmartinkpetersen
authored andcommitted
scsi: scsi_transport_srp: Don't block target in failfast state
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. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin Wilck <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent f2cb4b2 commit 72eeb7c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/scsi/scsi_transport_srp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,14 @@ int srp_reconnect_rport(struct srp_rport *rport)
541541
res = mutex_lock_interruptible(&rport->mutex);
542542
if (res)
543543
goto out;
544-
scsi_target_block(&shost->shost_gendev);
544+
if (rport->state != SRP_RPORT_FAIL_FAST)
545+
/*
546+
* sdev state must be SDEV_TRANSPORT_OFFLINE, transition
547+
* to SDEV_BLOCK is illegal. Calling scsi_target_unblock()
548+
* later is ok though, scsi_internal_device_unblock_nowait()
549+
* treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK.
550+
*/
551+
scsi_target_block(&shost->shost_gendev);
545552
res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV;
546553
pr_debug("%s (state %d): transport.reconnect() returned %d\n",
547554
dev_name(&shost->shost_gendev), rport->state, res);

0 commit comments

Comments
 (0)