Commit 36e3cf27 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jens Axboe

scsi: Avoid that SCSI queues get stuck

If a .queue_rq() function returns BLK_MQ_RQ_QUEUE_BUSY then the block
driver that implements that function is responsible for rerunning the
hardware queue once requests can be queued again successfully.

commit 52d7f1b5 ("blk-mq: Avoid that requeueing starts stopped
queues") removed the blk_mq_stop_hw_queue() call from scsi_queue_rq()
for the BLK_MQ_RQ_QUEUE_BUSY case. Hence change all calls to functions
that are intended to rerun a busy queue such that these examine all
hardware queues instead of only stopped queues.

Since no other functions than scsi_internal_device_block() and
scsi_internal_device_unblock() should ever stop or restart a SCSI
queue, change the blk_mq_delay_queue() call into a
blk_mq_delay_run_hw_queue() call.

Fixes: commit 52d7f1b5 ("blk-mq: Avoid that requeueing starts stopped queues")
Fixes: commit 7e79dadc ("blk-mq: stop hardware queue in blk_mq_delay_queue()")
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Long Li <longli@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 7587a5ae
...@@ -496,7 +496,7 @@ static void scsi_run_queue(struct request_queue *q) ...@@ -496,7 +496,7 @@ static void scsi_run_queue(struct request_queue *q)
scsi_starved_list_run(sdev->host); scsi_starved_list_run(sdev->host);
if (q->mq_ops) if (q->mq_ops)
blk_mq_start_stopped_hw_queues(q, false); blk_mq_run_hw_queues(q, false);
else else
blk_run_queue(q); blk_run_queue(q);
} }
...@@ -667,7 +667,7 @@ static bool scsi_end_request(struct request *req, int error, ...@@ -667,7 +667,7 @@ static bool scsi_end_request(struct request *req, int error,
!list_empty(&sdev->host->starved_list)) !list_empty(&sdev->host->starved_list))
kblockd_schedule_work(&sdev->requeue_work); kblockd_schedule_work(&sdev->requeue_work);
else else
blk_mq_start_stopped_hw_queues(q, true); blk_mq_run_hw_queues(q, true);
} else { } else {
unsigned long flags; unsigned long flags;
...@@ -1974,7 +1974,7 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -1974,7 +1974,7 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
case BLK_MQ_RQ_QUEUE_BUSY: case BLK_MQ_RQ_QUEUE_BUSY:
if (atomic_read(&sdev->device_busy) == 0 && if (atomic_read(&sdev->device_busy) == 0 &&
!scsi_device_blocked(sdev)) !scsi_device_blocked(sdev))
blk_mq_delay_queue(hctx, SCSI_QUEUE_DELAY); blk_mq_delay_run_hw_queue(hctx, SCSI_QUEUE_DELAY);
break; break;
case BLK_MQ_RQ_QUEUE_ERROR: case BLK_MQ_RQ_QUEUE_ERROR:
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment