Skip to content

Commit 3af755a

Browse files
hreineckekeithbusch
authored andcommitted
nvme: move nvme_stop_keep_alive() back to original position
Stopping keep-alive not only stops the keep-alive workqueue, but also needs to be synchronized with I/O termination as we must not send a keep-alive command after all I/O had been terminated. So to avoid any regressions move the call to stop_keep_alive() back to its original position and ensure that keep-alive is correctly stopped failing to setup the admin queue. Fixes: 4733b65 ("nvme: start keep-alive after admin queue setup") Suggested-by: Sagi Grimberg <[email protected]> Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 11b9d0b commit 3af755a

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

drivers/nvme/host/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ EXPORT_SYMBOL_GPL(nvme_cancel_tagset);
482482

483483
void nvme_cancel_admin_tagset(struct nvme_ctrl *ctrl)
484484
{
485-
nvme_stop_keep_alive(ctrl);
486485
if (ctrl->admin_tagset) {
487486
blk_mq_tagset_busy_iter(ctrl->admin_tagset,
488487
nvme_cancel_request, ctrl);
@@ -4355,6 +4354,7 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
43554354
{
43564355
nvme_mpath_stop(ctrl);
43574356
nvme_auth_stop(ctrl);
4357+
nvme_stop_keep_alive(ctrl);
43584358
nvme_stop_failfast_work(ctrl);
43594359
flush_work(&ctrl->async_event_work);
43604360
cancel_work_sync(&ctrl->fw_act_work);

drivers/nvme/host/fc.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,12 +2530,6 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
25302530
* clean up the admin queue. Same thing as above.
25312531
*/
25322532
nvme_quiesce_admin_queue(&ctrl->ctrl);
2533-
2534-
/*
2535-
* Open-coding nvme_cancel_admin_tagset() as fc
2536-
* is not using nvme_cancel_request().
2537-
*/
2538-
nvme_stop_keep_alive(&ctrl->ctrl);
25392533
blk_sync_queue(ctrl->ctrl.admin_q);
25402534
blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
25412535
nvme_fc_terminate_exchange, &ctrl->ctrl);
@@ -3138,27 +3132,28 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
31383132
nvme_unquiesce_admin_queue(&ctrl->ctrl);
31393133

31403134
ret = nvme_init_ctrl_finish(&ctrl->ctrl, false);
3141-
if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags))
3142-
ret = -EIO;
31433135
if (ret)
31443136
goto out_disconnect_admin_queue;
3145-
3137+
if (test_bit(ASSOC_FAILED, &ctrl->flags)) {
3138+
ret = -EIO;
3139+
goto out_stop_keep_alive;
3140+
}
31463141
/* sanity checks */
31473142

31483143
/* FC-NVME does not have other data in the capsule */
31493144
if (ctrl->ctrl.icdoff) {
31503145
dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n",
31513146
ctrl->ctrl.icdoff);
31523147
ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
3153-
goto out_disconnect_admin_queue;
3148+
goto out_stop_keep_alive;
31543149
}
31553150

31563151
/* FC-NVME supports normal SGL Data Block Descriptors */
31573152
if (!nvme_ctrl_sgl_supported(&ctrl->ctrl)) {
31583153
dev_err(ctrl->ctrl.device,
31593154
"Mandatory sgls are not supported!\n");
31603155
ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
3161-
goto out_disconnect_admin_queue;
3156+
goto out_stop_keep_alive;
31623157
}
31633158

31643159
if (opts->queue_size > ctrl->ctrl.maxcmd) {
@@ -3205,6 +3200,8 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
32053200

32063201
out_term_aen_ops:
32073202
nvme_fc_term_aen_ops(ctrl);
3203+
out_stop_keep_alive:
3204+
nvme_stop_keep_alive(&ctrl->ctrl);
32083205
out_disconnect_admin_queue:
32093206
dev_warn(ctrl->ctrl.device,
32103207
"NVME-FC{%d}: create_assoc failed, assoc_id %llx ret %d\n",

drivers/nvme/host/rdma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)
10801080
nvme_rdma_free_io_queues(ctrl);
10811081
}
10821082
destroy_admin:
1083+
nvme_stop_keep_alive(&ctrl->ctrl);
10831084
nvme_quiesce_admin_queue(&ctrl->ctrl);
10841085
blk_sync_queue(ctrl->ctrl.admin_q);
10851086
nvme_rdma_stop_queue(&ctrl->queues[0]);

drivers/nvme/host/tcp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,6 +2237,7 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
22372237
nvme_tcp_destroy_io_queues(ctrl, new);
22382238
}
22392239
destroy_admin:
2240+
nvme_stop_keep_alive(ctrl);
22402241
nvme_tcp_teardown_admin_queue(ctrl, false);
22412242
return ret;
22422243
}

0 commit comments

Comments
 (0)