Skip to contentSkip to conversation

nvme-rdma: unquiesce io queues before destroying them

PATCH New Sagi Grimberg 2 participants 3 messages Jul 4, 2018 – Jul 8, 2018 NVMe

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/2 nvme-rdma: unquiesce io queues before destroying them

if the controller is going away completey, blk_cleanup_queue make block on queue freeze if we don't unquiesce. To fix this, modify nvme_rdma_teardown_io_queues to only unquiesce if the controller is being removed, and do it before we destroy the io queues completely.

Fixes 037011f47e22 ("nvme-rdma: unquiesce queues when deleting the controller")
Signed-off-by Sagi Grimberg <sagi at grimberg.me>

---
** fold into 037011f47e22

 drivers/nvme/host/rdma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/nvme/host/rdma.c +4 -4
index 66d1cf92d163..f369e8be5233 100644
@@ -1741,15 +1741,15 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
 		nvme_rdma_stop_io_queues(ctrl);
 		blk_mq_tagset_busy_iter(&ctrl->tag_set,
 					nvme_cancel_request, &ctrl->ctrl);
+		if (shutdown)
+			nvme_start_queues(&ctrl->ctrl);
 		nvme_rdma_destroy_io_queues(ctrl, shutdown);
 	}
 
-	if (shutdown) {
-		nvme_start_queues(&ctrl->ctrl);
+	if (shutdown)
 		nvme_shutdown_ctrl(&ctrl->ctrl);
-	} else {
+	else
 		nvme_disable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap);
-	}
 
 	blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
 	nvme_rdma_stop_queue(&ctrl->queues[0]);
Signature · 1 line
2.14.1
author maintainer
#1 lore raw

PATCH 2/2 nvme-rdma: centralize admin/io queue teardown sequence

We follow the same queue teardown sequence in delete, reset and error recovery. Centralize the logic. This patch does not change any functionality.

Signed-off-by Sagi Grimberg <sagi at grimberg.me>

---
** This is the modified a20f15552bc6 ("nvme-rdma: centralize admin/io queue teardown sequence")

 drivers/nvme/host/rdma.c | 66 +++++++++++++++++++++---------------------------
 1 file changed, 29 insertions(+), 37 deletions(-)
drivers/nvme/host/rdma.c +29 -37
index 357bdcd8169b..24c624cc750d 100644
@@ -868,6 +868,31 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)
 	return ret;
 }
 
+static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
+		bool remove)
+{
+	blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
+	nvme_rdma_stop_queue(&ctrl->queues[0]);
+	blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, nvme_cancel_request,
+			&ctrl->ctrl);
+	blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
+	nvme_rdma_destroy_admin_queue(ctrl, remove);
+}
+
+static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
+		bool remove)
+{
+	if (ctrl->ctrl.queue_count > 1) {
+		nvme_stop_queues(&ctrl->ctrl);
+		nvme_rdma_stop_io_queues(ctrl);
+		blk_mq_tagset_busy_iter(&ctrl->tag_set, nvme_cancel_request,
+				&ctrl->ctrl);
+		if (remove)
+			nvme_start_queues(&ctrl->ctrl);
+		nvme_rdma_destroy_io_queues(ctrl, remove);
+	}
+}
+
 static void nvme_rdma_stop_ctrl(struct nvme_ctrl *nctrl)
 {
 	struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl);
@@ -1000,27 +1025,9 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
 			struct nvme_rdma_ctrl, err_work);
 
 	nvme_stop_keep_alive(&ctrl->ctrl);
-
-	if (ctrl->ctrl.queue_count > 1) {
-		nvme_stop_queues(&ctrl->ctrl);
-		nvme_rdma_stop_io_queues(ctrl);
-		blk_mq_tagset_busy_iter(&ctrl->tag_set,
-					nvme_cancel_request, &ctrl->ctrl);
-		nvme_rdma_destroy_io_queues(ctrl, false);
-	}
-
-	blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
-	nvme_rdma_stop_queue(&ctrl->queues[0]);
-	blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
-				nvme_cancel_request, &ctrl->ctrl);
-	nvme_rdma_destroy_admin_queue(ctrl, false);
-
-	/*
-	 * queues are not a live anymore, so restart the queues to fail fast
-	 * new IO
-	 */
-	blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
+	nvme_rdma_teardown_io_queues(ctrl, false);
 	nvme_start_queues(&ctrl->ctrl);
+	nvme_rdma_teardown_admin_queue(ctrl, false);
 
 	if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
 		/* state change failure is ok if we're in DELETING state */
@@ -1774,27 +1781,12 @@ static const struct blk_mq_ops nvme_rdma_admin_mq_ops = {
 
 static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
 {
-	if (ctrl->ctrl.queue_count > 1) {
-		nvme_stop_queues(&ctrl->ctrl);
-		nvme_rdma_stop_io_queues(ctrl);
-		blk_mq_tagset_busy_iter(&ctrl->tag_set,
-					nvme_cancel_request, &ctrl->ctrl);
-		if (shutdown)
-			nvme_start_queues(&ctrl->ctrl);
-		nvme_rdma_destroy_io_queues(ctrl, shutdown);
-	}
-
+	nvme_rdma_teardown_io_queues(ctrl, shutdown);
 	if (shutdown)
 		nvme_shutdown_ctrl(&ctrl->ctrl);
 	else
 		nvme_disable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap);
-
-	blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
-	nvme_rdma_stop_queue(&ctrl->queues[0]);
-	blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
-				nvme_cancel_request, &ctrl->ctrl);
-	blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
-	nvme_rdma_destroy_admin_queue(ctrl, shutdown);
+	nvme_rdma_teardown_admin_queue(ctrl, shutdown);
 }
 
 static void nvme_rdma_delete_ctrl(struct nvme_ctrl *ctrl)
Signature · 1 line
2.14.1
#2 lore raw

PATCH 1/2 nvme-rdma: unquiesce io queues before destroying them

In reply to Sagi Grimberg

?f I fold this patch your later patch to centralize the setup fails with nasty merge errors.

Can you please just resend the whole rdma fixes series?

I'll drop the following patches that should be resent:

nvme-rdma: unquiesce queues when deleting the controller
nvme-rdma: centralize controller setup sequence
nvme-rdma: centralize admin/io queue teardown sequence

Quoted 40 lines · Sagi Grimberg

if the controller is going away completey, blk_cleanup_queue make block on queue freeze if we don't unquiesce. To fix this, modify nvme_rdma_teardown_io_queues to only unquiesce if the controller is being removed, and do it before we destroy the io queues completely.

Fixes 037011f47e22 ("nvme-rdma: unquiesce queues when deleting the controller")
Signed-off-by Sagi Grimberg <sagi at grimberg.me>

---
** fold into 037011f47e22

 drivers/nvme/host/rdma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/nvme/host/rdma.c +4 -4
index 66d1cf92d163..f369e8be5233 100644
@@ -1741,15 +1741,15 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
 		nvme_rdma_stop_io_queues(ctrl);
 		blk_mq_tagset_busy_iter(&ctrl->tag_set,
 					nvme_cancel_request, &ctrl->ctrl);
+		if (shutdown)
+			nvme_start_queues(&ctrl->ctrl);
 		nvme_rdma_destroy_io_queues(ctrl, shutdown);
 	}
 
-	if (shutdown) {
-		nvme_start_queues(&ctrl->ctrl);
+	if (shutdown)
 		nvme_shutdown_ctrl(&ctrl->ctrl);
-	} else {
+	else
 		nvme_disable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap);
-	}
 
 	blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
 	nvme_rdma_stop_queue(&ctrl->queues[0]);
Signature · 1 line
2.14.1

---end quoted text---