Skip to content

Commit 806f026

Browse files
Ming LeiChristoph Hellwig
authored andcommitted
nvme: use blk_mq_start_hw_queues() in nvme_kill_queues()
Inside nvme_kill_queues(), we have to start hw queues for draining requests in sw queues, .dispatch list and requeue list, so use blk_mq_start_hw_queues() instead of blk_mq_start_stopped_hw_queues() which only run queues if queues are stopped, but the queues may have been started already, for example nvme_start_queues() is called in reset work function. blk_mq_start_hw_queues() run hw queues in current context, instead of running asynchronously like before. Given nvme_kill_queues() is run from either remove context or reset worker context, both are fine to run hw queue directly. And the mutex of namespaces_mutex isn't a problem too becasue nvme_start_freeze() runs hw queue in this way already. Cc: [email protected] Reported-by: Zhang Yi <[email protected]> Reviewed-by: Keith Busch <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 0544f54 commit 806f026

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,13 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
24372437
revalidate_disk(ns->disk);
24382438
blk_set_queue_dying(ns->queue);
24392439
blk_mq_abort_requeue_list(ns->queue);
2440-
blk_mq_start_stopped_hw_queues(ns->queue, true);
2440+
2441+
/*
2442+
* Forcibly start all queues to avoid having stuck requests.
2443+
* Note that we must ensure the queues are not stopped
2444+
* when the final removal happens.
2445+
*/
2446+
blk_mq_start_hw_queues(ns->queue);
24412447
}
24422448
mutex_unlock(&ctrl->namespaces_mutex);
24432449
}

0 commit comments

Comments
 (0)