Skip to content

Commit e68ca75

Browse files
Bart Van Asschedledford
authored andcommitted
scsi_transport_srp: Reduce failover time
Unlike FC, there is no risk that SCSI devices will be offlined by the SCSI error handler if the SCSI error handler is started while a reconnect attempt is ongoing. Hence report timeout errors as soon as possible if a higher software layer (e.g. multipathd) needs to be informed about a timeout. It is assumed that if both fast_io_fail_tmo < 0 and rport->dev_loss_tmo < 0 that this means that there is no need to report timeouts quickly. Signed-off-by: Bart Van Assche <[email protected]> Cc: James Bottomley <[email protected]> Cc: Sagi Grimberg <[email protected]> Cc: Sebastian Parschauer <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent a44074f commit e68ca75

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
@@ -61,6 +61,11 @@ static inline struct Scsi_Host *rport_to_shost(struct srp_rport *r)
6161
return dev_to_shost(r->dev.parent);
6262
}
6363

64+
static inline struct srp_rport *shost_to_rport(struct Scsi_Host *shost)
65+
{
66+
return transport_class_to_srp_rport(&shost->shost_gendev);
67+
}
68+
6469
/**
6570
* srp_tmo_valid() - check timeout combination validity
6671
* @reconnect_delay: Reconnect delay in seconds.
@@ -628,9 +633,11 @@ static enum blk_eh_timer_return srp_timed_out(struct scsi_cmnd *scmd)
628633
struct scsi_device *sdev = scmd->device;
629634
struct Scsi_Host *shost = sdev->host;
630635
struct srp_internal *i = to_srp_internal(shost->transportt);
636+
struct srp_rport *rport = shost_to_rport(shost);
631637

632638
pr_debug("timeout for sdev %s\n", dev_name(&sdev->sdev_gendev));
633-
return i->f->reset_timer_if_blocked && scsi_device_blocked(sdev) ?
639+
return rport->fast_io_fail_tmo < 0 && rport->dev_loss_tmo < 0 &&
640+
i->f->reset_timer_if_blocked && scsi_device_blocked(sdev) ?
634641
BLK_EH_RESET_TIMER : BLK_EH_NOT_HANDLED;
635642
}
636643

0 commit comments

Comments
 (0)