Move wait_for check to scsi_queue_insert. Signed-off-by: Mike Christie <michaelc@xxxxxxxxxxx> Signed-off-by: Mike Anderson <andmike@xxxxxxxxxxxxxxxxxx> --- 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 ff5d56b..b340087 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -115,11 +115,20 @@ int scsi_queue_insert(struct scsi_cmnd *cmd, int reason) struct Scsi_Host *host = cmd->device->host; struct scsi_device *device = cmd->device; struct request_queue *q = device->request_queue; + unsigned long wait_for = (cmd->allowed + 1) * cmd->timeout_per_command; 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. * @@ -1421,19 +1430,11 @@ 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->completion_data; - unsigned long wait_for = (cmd->allowed + 1) * cmd->timeout_per_command; int disposition; INIT_LIST_HEAD(&cmd->eh_entry); 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