提交 18cc4e02 编写于 作者: B Bart Van Assche 提交者: Roland Dreier

scsi_transport_srp: Block rport upon TL error even with fast_io_fail_tmo = off

The current behavior of the SRP transport layer when a transport layer
error is encountered is to block SCSI command processing only if
fast_io_fail_tmo != off.  The current behavior of the FC transport
layer when a transport layer error is encountered is to block SCSI
command processing no matter which value fast_io_fail_tmo has been set
to.  Make the behavior of the SRP transport layer consistent with that
of the FC transport layer to avoid confusion.
Signed-off-by: NBart Van Assche <bvanassche@acm.org>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 e6b45d49
...@@ -67,7 +67,8 @@ static inline struct Scsi_Host *rport_to_shost(struct srp_rport *r) ...@@ -67,7 +67,8 @@ static inline struct Scsi_Host *rport_to_shost(struct srp_rport *r)
* *
* The combination of the timeout parameters must be such that SCSI commands * The combination of the timeout parameters must be such that SCSI commands
* are finished in a reasonable time. Hence do not allow the fast I/O fail * are finished in a reasonable time. Hence do not allow the fast I/O fail
* timeout to exceed SCSI_DEVICE_BLOCK_MAX_TIMEOUT. Furthermore, these * timeout to exceed SCSI_DEVICE_BLOCK_MAX_TIMEOUT nor allow dev_loss_tmo to
* exceed that limit if failing I/O fast has been disabled. Furthermore, these
* parameters must be such that multipath can detect failed paths timely. * parameters must be such that multipath can detect failed paths timely.
* Hence do not allow all three parameters to be disabled simultaneously. * Hence do not allow all three parameters to be disabled simultaneously.
*/ */
...@@ -79,6 +80,9 @@ int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, int dev_loss_tmo) ...@@ -79,6 +80,9 @@ int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, int dev_loss_tmo)
return -EINVAL; return -EINVAL;
if (fast_io_fail_tmo > SCSI_DEVICE_BLOCK_MAX_TIMEOUT) if (fast_io_fail_tmo > SCSI_DEVICE_BLOCK_MAX_TIMEOUT)
return -EINVAL; return -EINVAL;
if (fast_io_fail_tmo < 0 &&
dev_loss_tmo > SCSI_DEVICE_BLOCK_MAX_TIMEOUT)
return -EINVAL;
if (dev_loss_tmo >= LONG_MAX / HZ) if (dev_loss_tmo >= LONG_MAX / HZ)
return -EINVAL; return -EINVAL;
if (fast_io_fail_tmo >= 0 && dev_loss_tmo >= 0 && if (fast_io_fail_tmo >= 0 && dev_loss_tmo >= 0 &&
...@@ -463,20 +467,20 @@ static void __srp_start_tl_fail_timers(struct srp_rport *rport) ...@@ -463,20 +467,20 @@ static void __srp_start_tl_fail_timers(struct srp_rport *rport)
queue_delayed_work(system_long_wq, queue_delayed_work(system_long_wq,
&rport->reconnect_work, &rport->reconnect_work,
1UL * delay * HZ); 1UL * delay * HZ);
if (fast_io_fail_tmo >= 0 && if (srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) {
srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) {
pr_debug("%s new state: %d\n", pr_debug("%s new state: %d\n",
dev_name(&shost->shost_gendev), dev_name(&shost->shost_gendev),
rport->state); rport->state);
scsi_target_block(&shost->shost_gendev); scsi_target_block(&shost->shost_gendev);
queue_delayed_work(system_long_wq, if (fast_io_fail_tmo >= 0)
&rport->fast_io_fail_work, queue_delayed_work(system_long_wq,
1UL * fast_io_fail_tmo * HZ); &rport->fast_io_fail_work,
1UL * fast_io_fail_tmo * HZ);
if (dev_loss_tmo >= 0)
queue_delayed_work(system_long_wq,
&rport->dev_loss_work,
1UL * dev_loss_tmo * HZ);
} }
if (dev_loss_tmo >= 0)
queue_delayed_work(system_long_wq,
&rport->dev_loss_work,
1UL * dev_loss_tmo * HZ);
} else { } else {
pr_debug("%s has already been deleted\n", pr_debug("%s has already been deleted\n",
dev_name(&shost->shost_gendev)); dev_name(&shost->shost_gendev));
...@@ -578,9 +582,9 @@ int srp_reconnect_rport(struct srp_rport *rport) ...@@ -578,9 +582,9 @@ int srp_reconnect_rport(struct srp_rport *rport)
spin_unlock_irq(shost->host_lock); spin_unlock_irq(shost->host_lock);
} else if (rport->state == SRP_RPORT_RUNNING) { } else if (rport->state == SRP_RPORT_RUNNING) {
/* /*
* srp_reconnect_rport() was invoked with fast_io_fail * srp_reconnect_rport() has been invoked with fast_io_fail
* off. Mark the port as failed and start the TL failure * and dev_loss off. Mark the port as failed and start the TL
* timers if these had not yet been started. * failure timers if these had not yet been started.
*/ */
__rport_fail_io_fast(rport); __rport_fail_io_fast(rport);
scsi_target_unblock(&shost->shost_gendev, scsi_target_unblock(&shost->shost_gendev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册