diff options
author | Bart Van Assche <bvanassche@acm.org> | 2013-12-11 11:05:22 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-01-21 13:46:17 -0500 |
commit | 18cc4e02508e3f1fadf81f697837567431ee5a9c (patch) | |
tree | 93e87be58cdceb7f84fed11673cda5631d2d4d58 /drivers/scsi | |
parent | e6b45d49b41110e0d795d17666c5850240829e0f (diff) |
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: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_transport_srp.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 2700a5a09bd4..8b9cb22be963 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c | |||
@@ -67,7 +67,8 @@ static inline struct Scsi_Host *rport_to_shost(struct srp_rport *r) | |||
67 | * | 67 | * |
68 | * The combination of the timeout parameters must be such that SCSI commands | 68 | * The combination of the timeout parameters must be such that SCSI commands |
69 | * are finished in a reasonable time. Hence do not allow the fast I/O fail | 69 | * are finished in a reasonable time. Hence do not allow the fast I/O fail |
70 | * timeout to exceed SCSI_DEVICE_BLOCK_MAX_TIMEOUT. Furthermore, these | 70 | * timeout to exceed SCSI_DEVICE_BLOCK_MAX_TIMEOUT nor allow dev_loss_tmo to |
71 | * exceed that limit if failing I/O fast has been disabled. Furthermore, these | ||
71 | * parameters must be such that multipath can detect failed paths timely. | 72 | * parameters must be such that multipath can detect failed paths timely. |
72 | * Hence do not allow all three parameters to be disabled simultaneously. | 73 | * Hence do not allow all three parameters to be disabled simultaneously. |
73 | */ | 74 | */ |
@@ -79,6 +80,9 @@ int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, int dev_loss_tmo) | |||
79 | return -EINVAL; | 80 | return -EINVAL; |
80 | if (fast_io_fail_tmo > SCSI_DEVICE_BLOCK_MAX_TIMEOUT) | 81 | if (fast_io_fail_tmo > SCSI_DEVICE_BLOCK_MAX_TIMEOUT) |
81 | return -EINVAL; | 82 | return -EINVAL; |
83 | if (fast_io_fail_tmo < 0 && | ||
84 | dev_loss_tmo > SCSI_DEVICE_BLOCK_MAX_TIMEOUT) | ||
85 | return -EINVAL; | ||
82 | if (dev_loss_tmo >= LONG_MAX / HZ) | 86 | if (dev_loss_tmo >= LONG_MAX / HZ) |
83 | return -EINVAL; | 87 | return -EINVAL; |
84 | if (fast_io_fail_tmo >= 0 && dev_loss_tmo >= 0 && | 88 | 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 | queue_delayed_work(system_long_wq, | 467 | queue_delayed_work(system_long_wq, |
464 | &rport->reconnect_work, | 468 | &rport->reconnect_work, |
465 | 1UL * delay * HZ); | 469 | 1UL * delay * HZ); |
466 | if (fast_io_fail_tmo >= 0 && | 470 | if (srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) { |
467 | srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) { | ||
468 | pr_debug("%s new state: %d\n", | 471 | pr_debug("%s new state: %d\n", |
469 | dev_name(&shost->shost_gendev), | 472 | dev_name(&shost->shost_gendev), |
470 | rport->state); | 473 | rport->state); |
471 | scsi_target_block(&shost->shost_gendev); | 474 | scsi_target_block(&shost->shost_gendev); |
472 | queue_delayed_work(system_long_wq, | 475 | if (fast_io_fail_tmo >= 0) |
473 | &rport->fast_io_fail_work, | 476 | queue_delayed_work(system_long_wq, |
474 | 1UL * fast_io_fail_tmo * HZ); | 477 | &rport->fast_io_fail_work, |
478 | 1UL * fast_io_fail_tmo * HZ); | ||
479 | if (dev_loss_tmo >= 0) | ||
480 | queue_delayed_work(system_long_wq, | ||
481 | &rport->dev_loss_work, | ||
482 | 1UL * dev_loss_tmo * HZ); | ||
475 | } | 483 | } |
476 | if (dev_loss_tmo >= 0) | ||
477 | queue_delayed_work(system_long_wq, | ||
478 | &rport->dev_loss_work, | ||
479 | 1UL * dev_loss_tmo * HZ); | ||
480 | } else { | 484 | } else { |
481 | pr_debug("%s has already been deleted\n", | 485 | pr_debug("%s has already been deleted\n", |
482 | dev_name(&shost->shost_gendev)); | 486 | dev_name(&shost->shost_gendev)); |
@@ -578,9 +582,9 @@ int srp_reconnect_rport(struct srp_rport *rport) | |||
578 | spin_unlock_irq(shost->host_lock); | 582 | spin_unlock_irq(shost->host_lock); |
579 | } else if (rport->state == SRP_RPORT_RUNNING) { | 583 | } else if (rport->state == SRP_RPORT_RUNNING) { |
580 | /* | 584 | /* |
581 | * srp_reconnect_rport() was invoked with fast_io_fail | 585 | * srp_reconnect_rport() has been invoked with fast_io_fail |
582 | * off. Mark the port as failed and start the TL failure | 586 | * and dev_loss off. Mark the port as failed and start the TL |
583 | * timers if these had not yet been started. | 587 | * failure timers if these had not yet been started. |
584 | */ | 588 | */ |
585 | __rport_fail_io_fast(rport); | 589 | __rport_fail_io_fast(rport); |
586 | scsi_target_unblock(&shost->shost_gendev, | 590 | scsi_target_unblock(&shost->shost_gendev, |