From d0d3bbf96ec21167e55a48ebb31912918a674e0d Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 22 Jan 2014 18:39:04 +0100 Subject: scsi: centralize command re-queueing in scsi_dispatch_fn Make sure we only have the logic for requeing commands in one place. Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Hannes Reinecke Reviewed-by: Webb Scales Acked-by: Jens Axboe Tested-by: Bart Van Assche Tested-by: Robert Elliott --- drivers/scsi/scsi_lib.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/scsi/scsi_lib.c') diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3ac677c48168..bf7342748f32 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1557,9 +1557,12 @@ static void scsi_request_fn(struct request_queue *q) * Dispatch the command to the low-level driver. */ rtn = scsi_dispatch_cmd(cmd); - spin_lock_irq(q->queue_lock); - if (rtn) + if (rtn) { + scsi_queue_insert(cmd, rtn); + spin_lock_irq(q->queue_lock); goto out_delay; + } + spin_lock_irq(q->queue_lock); } return; @@ -1579,7 +1582,7 @@ static void scsi_request_fn(struct request_queue *q) blk_requeue_request(q, req); sdev->device_busy--; out_delay: - if (sdev->device_busy == 0) + if (sdev->device_busy == 0 && !scsi_device_blocked(sdev)) blk_delay_queue(q, SCSI_QUEUE_DELAY); } -- cgit v1.2.1