All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery
@ 2018-03-20 11:07 Nitzan Carmi
  2018-03-20 11:07 ` [PATCH 2/2] nvme: Add .stop_ctrl to nvme ctrl ops Nitzan Carmi
  2018-03-20 11:30 ` [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery Sagi Grimberg
  0 siblings, 2 replies; 4+ messages in thread
From: Nitzan Carmi @ 2018-03-20 11:07 UTC (permalink / raw)


While error recovery is ongoing, it is OK to move
ctrl to DELETING state (from concurrent delete_work).
Thus we don't need a warning for that case.

Signed-off-by: Nitzan Carmi <nitzanc at mellanox.com>
Reviewed-by: Max Gurtovoy <maxg at mellanox.com>
---
 drivers/nvme/host/rdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 64a4b8c..987691c 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -978,8 +978,8 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
 	nvme_start_queues(&ctrl->ctrl);
 
 	if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
-		/* state change failure should never happen */
-		WARN_ON_ONCE(1);
+		/* state change failure is ok if we're in DELETING state */
+		WARN_ON_ONCE(ctrl->ctrl.state != NVME_CTRL_DELETING);
 		return;
 	}
 
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] nvme: Add .stop_ctrl to nvme ctrl ops
  2018-03-20 11:07 [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery Nitzan Carmi
@ 2018-03-20 11:07 ` Nitzan Carmi
  2018-03-20 11:30 ` [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery Sagi Grimberg
  1 sibling, 0 replies; 4+ messages in thread
From: Nitzan Carmi @ 2018-03-20 11:07 UTC (permalink / raw)


For consistancy reasons, any fabric-specific works
(e.g error recovery/reconnect) should be canceled in
nvme_stop_ctrl, as for all other NVMe pending works
(e.g. scan, keep alive).

The patch aims to simplify the logic of the code, as
we now only rely on a vague demand from any fabric
to flush its private workqueues at the beginning of
.delete_ctrl op.

Signed-off-by: Nitzan Carmi <nitzanc at mellanox.com>
Reviewed-by: Max Gurtovoy <maxg at mellanox.com>
---
 drivers/nvme/host/core.c |  2 ++
 drivers/nvme/host/nvme.h |  1 +
 drivers/nvme/host/rdma.c | 12 +++++++++---
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 832c51a..17e0fdd 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3336,6 +3336,8 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
 	flush_work(&ctrl->async_event_work);
 	flush_work(&ctrl->scan_work);
 	cancel_work_sync(&ctrl->fw_act_work);
+	if (ctrl->ops->stop_ctrl)
+		ctrl->ops->stop_ctrl(ctrl);
 }
 EXPORT_SYMBOL_GPL(nvme_stop_ctrl);
 
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 133b783..4adb413 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -298,6 +298,7 @@ struct nvme_ctrl_ops {
 	void (*delete_ctrl)(struct nvme_ctrl *ctrl);
 	int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size);
 	int (*reinit_request)(void *data, struct request *rq);
+	void (*stop_ctrl)(struct nvme_ctrl *ctrl);
 };
 
 static inline bool nvme_ctrl_ready(struct nvme_ctrl *ctrl)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 987691c..535a4b4 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -871,6 +871,14 @@ out_free_io_queues:
 	return ret;
 }
 
+static void nvme_rdma_stop_ctrl(struct nvme_ctrl *nctrl)
+{
+	struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl);
+
+	cancel_work_sync(&ctrl->err_work);
+	cancel_delayed_work_sync(&ctrl->reconnect_work);
+}
+
 static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl)
 {
 	struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl);
@@ -1723,9 +1731,6 @@ static const struct blk_mq_ops nvme_rdma_admin_mq_ops = {
 
 static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
 {
-	cancel_work_sync(&ctrl->err_work);
-	cancel_delayed_work_sync(&ctrl->reconnect_work);
-
 	if (ctrl->ctrl.queue_count > 1) {
 		nvme_stop_queues(&ctrl->ctrl);
 		blk_mq_tagset_busy_iter(&ctrl->tag_set,
@@ -1803,6 +1808,7 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = {
 	.submit_async_event	= nvme_rdma_submit_async_event,
 	.delete_ctrl		= nvme_rdma_delete_ctrl,
 	.get_address		= nvmf_get_address,
+	.stop_ctrl		= nvme_rdma_stop_ctrl,
 };
 
 static inline bool
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery
  2018-03-20 11:07 [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery Nitzan Carmi
  2018-03-20 11:07 ` [PATCH 2/2] nvme: Add .stop_ctrl to nvme ctrl ops Nitzan Carmi
@ 2018-03-20 11:30 ` Sagi Grimberg
  2018-03-20 22:11   ` Keith Busch
  1 sibling, 1 reply; 4+ messages in thread
From: Sagi Grimberg @ 2018-03-20 11:30 UTC (permalink / raw)


Looks good,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery
  2018-03-20 11:30 ` [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery Sagi Grimberg
@ 2018-03-20 22:11   ` Keith Busch
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2018-03-20 22:11 UTC (permalink / raw)


On Tue, Mar 20, 2018@01:30:50PM +0200, Sagi Grimberg wrote:
> Looks good,
> 
> Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

Thanks, applied to nvme-4.17.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-20 22:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20 11:07 [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery Nitzan Carmi
2018-03-20 11:07 ` [PATCH 2/2] nvme: Add .stop_ctrl to nvme ctrl ops Nitzan Carmi
2018-03-20 11:30 ` [PATCH 1/2] nvme-rdma: Allow DELETING state change failure in error_recovery Sagi Grimberg
2018-03-20 22:11   ` Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.