nvme: apply nvme API to quiesce/unquiesce admin queue
Apply the added two APIs to quiesce/unquiesce admin queue. Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20211014081710.1871747-3-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a277654baf
commit
6ca1d9027e
|
@ -4500,7 +4500,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
|
||||||
|
|
||||||
/* Forcibly unquiesce queues to avoid blocking dispatch */
|
/* Forcibly unquiesce queues to avoid blocking dispatch */
|
||||||
if (ctrl->admin_q && !blk_queue_dying(ctrl->admin_q))
|
if (ctrl->admin_q && !blk_queue_dying(ctrl->admin_q))
|
||||||
blk_mq_unquiesce_queue(ctrl->admin_q);
|
nvme_start_admin_queue(ctrl);
|
||||||
|
|
||||||
list_for_each_entry(ns, &ctrl->namespaces, list)
|
list_for_each_entry(ns, &ctrl->namespaces, list)
|
||||||
nvme_set_queue_dying(ns);
|
nvme_set_queue_dying(ns);
|
||||||
|
|
|
@ -2382,7 +2382,7 @@ nvme_fc_ctrl_free(struct kref *ref)
|
||||||
list_del(&ctrl->ctrl_list);
|
list_del(&ctrl->ctrl_list);
|
||||||
spin_unlock_irqrestore(&ctrl->rport->lock, flags);
|
spin_unlock_irqrestore(&ctrl->rport->lock, flags);
|
||||||
|
|
||||||
blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
|
nvme_start_admin_queue(&ctrl->ctrl);
|
||||||
blk_cleanup_queue(ctrl->ctrl.admin_q);
|
blk_cleanup_queue(ctrl->ctrl.admin_q);
|
||||||
blk_cleanup_queue(ctrl->ctrl.fabrics_q);
|
blk_cleanup_queue(ctrl->ctrl.fabrics_q);
|
||||||
blk_mq_free_tag_set(&ctrl->admin_tag_set);
|
blk_mq_free_tag_set(&ctrl->admin_tag_set);
|
||||||
|
@ -2510,7 +2510,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
|
||||||
/*
|
/*
|
||||||
* clean up the admin queue. Same thing as above.
|
* clean up the admin queue. Same thing as above.
|
||||||
*/
|
*/
|
||||||
blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
|
nvme_stop_admin_queue(&ctrl->ctrl);
|
||||||
blk_sync_queue(ctrl->ctrl.admin_q);
|
blk_sync_queue(ctrl->ctrl.admin_q);
|
||||||
blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
|
blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
|
||||||
nvme_fc_terminate_exchange, &ctrl->ctrl);
|
nvme_fc_terminate_exchange, &ctrl->ctrl);
|
||||||
|
@ -3095,7 +3095,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
|
||||||
ctrl->ctrl.max_hw_sectors = ctrl->ctrl.max_segments <<
|
ctrl->ctrl.max_hw_sectors = ctrl->ctrl.max_segments <<
|
||||||
(ilog2(SZ_4K) - 9);
|
(ilog2(SZ_4K) - 9);
|
||||||
|
|
||||||
blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
|
nvme_start_admin_queue(&ctrl->ctrl);
|
||||||
|
|
||||||
ret = nvme_init_ctrl_finish(&ctrl->ctrl);
|
ret = nvme_init_ctrl_finish(&ctrl->ctrl);
|
||||||
if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
|
if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
|
||||||
|
@ -3249,7 +3249,7 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl)
|
||||||
nvme_fc_free_queue(&ctrl->queues[0]);
|
nvme_fc_free_queue(&ctrl->queues[0]);
|
||||||
|
|
||||||
/* re-enable the admin_q so anything new can fast fail */
|
/* re-enable the admin_q so anything new can fast fail */
|
||||||
blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
|
nvme_start_admin_queue(&ctrl->ctrl);
|
||||||
|
|
||||||
/* resume the io queues so that things will fast fail */
|
/* resume the io queues so that things will fast fail */
|
||||||
nvme_start_queues(&ctrl->ctrl);
|
nvme_start_queues(&ctrl->ctrl);
|
||||||
|
|
|
@ -1414,7 +1414,7 @@ static int nvme_suspend_queue(struct nvme_queue *nvmeq)
|
||||||
|
|
||||||
nvmeq->dev->online_queues--;
|
nvmeq->dev->online_queues--;
|
||||||
if (!nvmeq->qid && nvmeq->dev->ctrl.admin_q)
|
if (!nvmeq->qid && nvmeq->dev->ctrl.admin_q)
|
||||||
blk_mq_quiesce_queue(nvmeq->dev->ctrl.admin_q);
|
nvme_stop_admin_queue(&nvmeq->dev->ctrl);
|
||||||
if (!test_and_clear_bit(NVMEQ_POLLED, &nvmeq->flags))
|
if (!test_and_clear_bit(NVMEQ_POLLED, &nvmeq->flags))
|
||||||
pci_free_irq(to_pci_dev(nvmeq->dev->dev), nvmeq->cq_vector, nvmeq);
|
pci_free_irq(to_pci_dev(nvmeq->dev->dev), nvmeq->cq_vector, nvmeq);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1673,7 +1673,7 @@ static void nvme_dev_remove_admin(struct nvme_dev *dev)
|
||||||
* user requests may be waiting on a stopped queue. Start the
|
* user requests may be waiting on a stopped queue. Start the
|
||||||
* queue to flush these to completion.
|
* queue to flush these to completion.
|
||||||
*/
|
*/
|
||||||
blk_mq_unquiesce_queue(dev->ctrl.admin_q);
|
nvme_start_admin_queue(&dev->ctrl);
|
||||||
blk_cleanup_queue(dev->ctrl.admin_q);
|
blk_cleanup_queue(dev->ctrl.admin_q);
|
||||||
blk_mq_free_tag_set(&dev->admin_tagset);
|
blk_mq_free_tag_set(&dev->admin_tagset);
|
||||||
}
|
}
|
||||||
|
@ -1707,7 +1707,7 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
blk_mq_unquiesce_queue(dev->ctrl.admin_q);
|
nvme_start_admin_queue(&dev->ctrl);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2642,7 +2642,7 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
|
||||||
if (shutdown) {
|
if (shutdown) {
|
||||||
nvme_start_queues(&dev->ctrl);
|
nvme_start_queues(&dev->ctrl);
|
||||||
if (dev->ctrl.admin_q && !blk_queue_dying(dev->ctrl.admin_q))
|
if (dev->ctrl.admin_q && !blk_queue_dying(dev->ctrl.admin_q))
|
||||||
blk_mq_unquiesce_queue(dev->ctrl.admin_q);
|
nvme_start_admin_queue(&dev->ctrl);
|
||||||
}
|
}
|
||||||
mutex_unlock(&dev->shutdown_lock);
|
mutex_unlock(&dev->shutdown_lock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -919,7 +919,7 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
|
||||||
else
|
else
|
||||||
ctrl->ctrl.max_integrity_segments = 0;
|
ctrl->ctrl.max_integrity_segments = 0;
|
||||||
|
|
||||||
blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
|
nvme_start_admin_queue(&ctrl->ctrl);
|
||||||
|
|
||||||
error = nvme_init_ctrl_finish(&ctrl->ctrl);
|
error = nvme_init_ctrl_finish(&ctrl->ctrl);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -928,7 +928,7 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_quiesce_queue:
|
out_quiesce_queue:
|
||||||
blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
|
nvme_stop_admin_queue(&ctrl->ctrl);
|
||||||
blk_sync_queue(ctrl->ctrl.admin_q);
|
blk_sync_queue(ctrl->ctrl.admin_q);
|
||||||
out_stop_queue:
|
out_stop_queue:
|
||||||
nvme_rdma_stop_queue(&ctrl->queues[0]);
|
nvme_rdma_stop_queue(&ctrl->queues[0]);
|
||||||
|
@ -1026,12 +1026,12 @@ out_free_io_queues:
|
||||||
static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
|
static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
|
||||||
bool remove)
|
bool remove)
|
||||||
{
|
{
|
||||||
blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
|
nvme_stop_admin_queue(&ctrl->ctrl);
|
||||||
blk_sync_queue(ctrl->ctrl.admin_q);
|
blk_sync_queue(ctrl->ctrl.admin_q);
|
||||||
nvme_rdma_stop_queue(&ctrl->queues[0]);
|
nvme_rdma_stop_queue(&ctrl->queues[0]);
|
||||||
nvme_cancel_admin_tagset(&ctrl->ctrl);
|
nvme_cancel_admin_tagset(&ctrl->ctrl);
|
||||||
if (remove)
|
if (remove)
|
||||||
blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
|
nvme_start_admin_queue(&ctrl->ctrl);
|
||||||
nvme_rdma_destroy_admin_queue(ctrl, remove);
|
nvme_rdma_destroy_admin_queue(ctrl, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1154,7 +1154,7 @@ destroy_io:
|
||||||
nvme_rdma_destroy_io_queues(ctrl, new);
|
nvme_rdma_destroy_io_queues(ctrl, new);
|
||||||
}
|
}
|
||||||
destroy_admin:
|
destroy_admin:
|
||||||
blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
|
nvme_stop_admin_queue(&ctrl->ctrl);
|
||||||
blk_sync_queue(ctrl->ctrl.admin_q);
|
blk_sync_queue(ctrl->ctrl.admin_q);
|
||||||
nvme_rdma_stop_queue(&ctrl->queues[0]);
|
nvme_rdma_stop_queue(&ctrl->queues[0]);
|
||||||
nvme_cancel_admin_tagset(&ctrl->ctrl);
|
nvme_cancel_admin_tagset(&ctrl->ctrl);
|
||||||
|
@ -1194,7 +1194,7 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
|
||||||
nvme_rdma_teardown_io_queues(ctrl, false);
|
nvme_rdma_teardown_io_queues(ctrl, false);
|
||||||
nvme_start_queues(&ctrl->ctrl);
|
nvme_start_queues(&ctrl->ctrl);
|
||||||
nvme_rdma_teardown_admin_queue(ctrl, false);
|
nvme_rdma_teardown_admin_queue(ctrl, false);
|
||||||
blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
|
nvme_start_admin_queue(&ctrl->ctrl);
|
||||||
|
|
||||||
if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
|
if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
|
||||||
/* state change failure is ok if we started ctrl delete */
|
/* state change failure is ok if we started ctrl delete */
|
||||||
|
@ -2232,7 +2232,7 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
|
||||||
cancel_delayed_work_sync(&ctrl->reconnect_work);
|
cancel_delayed_work_sync(&ctrl->reconnect_work);
|
||||||
|
|
||||||
nvme_rdma_teardown_io_queues(ctrl, shutdown);
|
nvme_rdma_teardown_io_queues(ctrl, shutdown);
|
||||||
blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
|
nvme_stop_admin_queue(&ctrl->ctrl);
|
||||||
if (shutdown)
|
if (shutdown)
|
||||||
nvme_shutdown_ctrl(&ctrl->ctrl);
|
nvme_shutdown_ctrl(&ctrl->ctrl);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1915,7 +1915,7 @@ static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new)
|
||||||
if (error)
|
if (error)
|
||||||
goto out_stop_queue;
|
goto out_stop_queue;
|
||||||
|
|
||||||
blk_mq_unquiesce_queue(ctrl->admin_q);
|
nvme_start_admin_queue(ctrl);
|
||||||
|
|
||||||
error = nvme_init_ctrl_finish(ctrl);
|
error = nvme_init_ctrl_finish(ctrl);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -1924,7 +1924,7 @@ static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_quiesce_queue:
|
out_quiesce_queue:
|
||||||
blk_mq_quiesce_queue(ctrl->admin_q);
|
nvme_stop_admin_queue(ctrl);
|
||||||
blk_sync_queue(ctrl->admin_q);
|
blk_sync_queue(ctrl->admin_q);
|
||||||
out_stop_queue:
|
out_stop_queue:
|
||||||
nvme_tcp_stop_queue(ctrl, 0);
|
nvme_tcp_stop_queue(ctrl, 0);
|
||||||
|
@ -1946,12 +1946,12 @@ out_free_queue:
|
||||||
static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
|
static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
|
||||||
bool remove)
|
bool remove)
|
||||||
{
|
{
|
||||||
blk_mq_quiesce_queue(ctrl->admin_q);
|
nvme_stop_admin_queue(ctrl);
|
||||||
blk_sync_queue(ctrl->admin_q);
|
blk_sync_queue(ctrl->admin_q);
|
||||||
nvme_tcp_stop_queue(ctrl, 0);
|
nvme_tcp_stop_queue(ctrl, 0);
|
||||||
nvme_cancel_admin_tagset(ctrl);
|
nvme_cancel_admin_tagset(ctrl);
|
||||||
if (remove)
|
if (remove)
|
||||||
blk_mq_unquiesce_queue(ctrl->admin_q);
|
nvme_start_admin_queue(ctrl);
|
||||||
nvme_tcp_destroy_admin_queue(ctrl, remove);
|
nvme_tcp_destroy_admin_queue(ctrl, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1960,7 +1960,7 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
|
||||||
{
|
{
|
||||||
if (ctrl->queue_count <= 1)
|
if (ctrl->queue_count <= 1)
|
||||||
return;
|
return;
|
||||||
blk_mq_quiesce_queue(ctrl->admin_q);
|
nvme_stop_admin_queue(ctrl);
|
||||||
nvme_start_freeze(ctrl);
|
nvme_start_freeze(ctrl);
|
||||||
nvme_stop_queues(ctrl);
|
nvme_stop_queues(ctrl);
|
||||||
nvme_sync_io_queues(ctrl);
|
nvme_sync_io_queues(ctrl);
|
||||||
|
@ -2055,7 +2055,7 @@ destroy_io:
|
||||||
nvme_tcp_destroy_io_queues(ctrl, new);
|
nvme_tcp_destroy_io_queues(ctrl, new);
|
||||||
}
|
}
|
||||||
destroy_admin:
|
destroy_admin:
|
||||||
blk_mq_quiesce_queue(ctrl->admin_q);
|
nvme_stop_admin_queue(ctrl);
|
||||||
blk_sync_queue(ctrl->admin_q);
|
blk_sync_queue(ctrl->admin_q);
|
||||||
nvme_tcp_stop_queue(ctrl, 0);
|
nvme_tcp_stop_queue(ctrl, 0);
|
||||||
nvme_cancel_admin_tagset(ctrl);
|
nvme_cancel_admin_tagset(ctrl);
|
||||||
|
@ -2098,7 +2098,7 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work)
|
||||||
/* unquiesce to fail fast pending requests */
|
/* unquiesce to fail fast pending requests */
|
||||||
nvme_start_queues(ctrl);
|
nvme_start_queues(ctrl);
|
||||||
nvme_tcp_teardown_admin_queue(ctrl, false);
|
nvme_tcp_teardown_admin_queue(ctrl, false);
|
||||||
blk_mq_unquiesce_queue(ctrl->admin_q);
|
nvme_start_admin_queue(ctrl);
|
||||||
|
|
||||||
if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING)) {
|
if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING)) {
|
||||||
/* state change failure is ok if we started ctrl delete */
|
/* state change failure is ok if we started ctrl delete */
|
||||||
|
@ -2116,7 +2116,7 @@ static void nvme_tcp_teardown_ctrl(struct nvme_ctrl *ctrl, bool shutdown)
|
||||||
cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work);
|
cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work);
|
||||||
|
|
||||||
nvme_tcp_teardown_io_queues(ctrl, shutdown);
|
nvme_tcp_teardown_io_queues(ctrl, shutdown);
|
||||||
blk_mq_quiesce_queue(ctrl->admin_q);
|
nvme_stop_admin_queue(ctrl);
|
||||||
if (shutdown)
|
if (shutdown)
|
||||||
nvme_shutdown_ctrl(ctrl);
|
nvme_shutdown_ctrl(ctrl);
|
||||||
else
|
else
|
||||||
|
|
|
@ -398,7 +398,7 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl)
|
||||||
ctrl->ctrl.max_hw_sectors =
|
ctrl->ctrl.max_hw_sectors =
|
||||||
(NVME_LOOP_MAX_SEGMENTS - 1) << (PAGE_SHIFT - 9);
|
(NVME_LOOP_MAX_SEGMENTS - 1) << (PAGE_SHIFT - 9);
|
||||||
|
|
||||||
blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
|
nvme_start_admin_queue(&ctrl->ctrl);
|
||||||
|
|
||||||
error = nvme_init_ctrl_finish(&ctrl->ctrl);
|
error = nvme_init_ctrl_finish(&ctrl->ctrl);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -428,7 +428,7 @@ static void nvme_loop_shutdown_ctrl(struct nvme_loop_ctrl *ctrl)
|
||||||
nvme_loop_destroy_io_queues(ctrl);
|
nvme_loop_destroy_io_queues(ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
|
nvme_stop_admin_queue(&ctrl->ctrl);
|
||||||
if (ctrl->ctrl.state == NVME_CTRL_LIVE)
|
if (ctrl->ctrl.state == NVME_CTRL_LIVE)
|
||||||
nvme_shutdown_ctrl(&ctrl->ctrl);
|
nvme_shutdown_ctrl(&ctrl->ctrl);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue