timeout needs to be adjusted when eh was running
PATCH 3/5 timeout needs to be adjusted when eh was running
If the error handler was active and we use the normal command timeout, the command will probably fail, even though the error handler may have succeeded to recover the device.
Signed-off-by Bernd Schubert <[email protected]>
drivers/scsi/scsi_error.c | 3 +++ drivers/scsi/scsi_lib.c | 13 ++++++++++++- include/scsi/scsi_host.h | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +12 -1
@@ -1537,7 +1537,9 @@ static void scsi_softirq_done(struct req {struct scsi_cmnd *cmd = rq->special;unsigned long wait_for = (cmd->allowed +1 ) * rq->timeout; +unsigned long cmd_start;int disposition; +struct Scsi_Host *shost = cmd->device->host;INIT_LIST_HEAD (&cmd->eh_entry);
@@ -1550,9 +1552,18 @@ static void scsi_softirq_done(struct reqif (cmd->result)atomic_inc (&cmd->device->ioerr_cnt); +/* +* If the error handler was active, the command will need more time, +* of course. +*/ +if (shost->last_recovery > cmd->jiffies_at_alloc) + cmd_start = shost->last_recovery; +else + cmd_start = cmd->jiffies_at_alloc; + disposition =scsi_decide_disposition (cmd);if (disposition !=SUCCESS && -time_before (cmd->jiffies_at_alloc + wait_for, jiffies)) { +time_before (cmd_start + wait_for, jiffies)) {sdev_printk (KERN_ERR , cmd->device,"timing out command, waited %lus\n" , wait_for/HZ );
include/scsi/scsi_host.h +2 -0
@@ -521,6 +521,8 @@ struct Scsi_Host {struct task_struct * ehandler;/* Error recovery thread. */ struct completion * eh_action;/* Wait for specific actions on the host. */ +unsigned long last_recovery;/* last time eh completed */ +wait_queue_head_t host_wait;struct scsi_host_template *hostt;struct scsi_transport_template *transportt;
drivers/scsi/scsi_error.c +3 -0
@@ -1559,6 +1559,9 @@ static void scsi_restart_operations(struBUG_ON (scsi_host_set_state (shost,SHOST_DEL ));spin_unlock_irqrestore (shost->host_lock, flags); +/* before starting the queues save the time of recovery */ + shost->last_recovery = jiffies; +wake_up (&shost->host_wait);/*
Signature · 2 lines
Bernd Schubert Q-Leap Networks GmbH