Message ID | 20210111142541.21534-1-mwilck@suse.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | scsi: scsi_transport_srp: don't block target in failfast state | expand |
On 1/11/21 6:25 AM, mwilck@suse.com wrote: > 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); Reviewed-by: Bart Van Assche <bvanassche@acm.org>
On Mon, 11 Jan 2021 15:25:41 +0100, mwilck@suse.com wrote: > 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. Applied to 5.11/scsi-fixes, thanks! [1/1] scsi: scsi_transport_srp: don't block target in failfast state https://git.kernel.org/mkp/scsi/c/72eeb7c71513
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);