Move wait_for check to scsi_queue_insert. Signed-off-by: Mike Anderson <andmike@xxxxxxxxxxxxxxxxxx> Acked-by: Mike Christie <michaelc@xxxxxxxxxxx> --- drivers/scsi/scsi_lib.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 517fd90..83a8aae 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -116,11 +116,20 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) struct scsi_device *device = cmd->device; struct scsi_target *starget = scsi_target(device); struct request_queue *q = device->request_queue; + unsigned long wait_for = (cmd->allowed + 1) * cmd->request->timeout; unsigned long flags; SCSI_LOG_MLQUEUE(1, printk("Inserting command %p into mlqueue\n", cmd)); + if (time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { + sdev_printk(KERN_ERR, cmd->device, "timing out command, " + "waited %lus\n", wait_for/HZ); + set_driver_byte(cmd, DRIVER_TIMEOUT); + scsi_finish_command(cmd); + return 0; + } + /* * Set the appropriate busy bit for the device/host. * @@ -1494,7 +1503,6 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) static void scsi_softirq_done(struct request *rq) { struct scsi_cmnd *cmd = rq->special; - unsigned long wait_for = (cmd->allowed + 1) * rq->timeout; int disposition; INIT_LIST_HEAD(&cmd->eh_entry); @@ -1509,13 +1517,6 @@ static void scsi_softirq_done(struct request *rq) atomic_inc(&cmd->device->ioerr_cnt); disposition = scsi_decide_disposition(cmd); - if (disposition != SUCCESS && - time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { - sdev_printk(KERN_ERR, cmd->device, - "timing out command, waited %lus\n", - wait_for/HZ); - disposition = SUCCESS; - } scsi_log_completion(cmd, disposition); -- 1.5.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html