Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] nvmet: reset keep alive timer in controller enable
@ 2018-06-19 12:45 Sagi Grimberg
  2018-06-19 12:45 ` [PATCH v2 2/2] nvme: start keep alive timer when enabling the controller Sagi Grimberg
  2018-06-20  9:06 ` [PATCH v2 1/2] nvmet: reset keep alive timer in controller enable Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Sagi Grimberg @ 2018-06-19 12:45 UTC (permalink / raw)


From: Max Gurtuvoy <maxg@mellanox.com>

Controllers that are not yet enabled should not really
enforce keep alive timeout, but we still want to track
a timeout and cleanup in case a host died before it enabled
us. Hence, simply reset the keep alive timer when the controller
is enabled.

Suggested-by: Max Gurtovoy <maxg at mellanox.com>
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
Changes from v1:
- Added some code documentation

 drivers/nvme/target/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index a03da764ecae..1ade6fe9b830 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -686,6 +686,14 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
 	}
 
 	ctrl->csts = NVME_CSTS_RDY;
+	/*
+	 * Controllers that are not yet enabled should not really
+	 * enforce keep alive timeout, but we still want to track
+	 * a timeout and cleanup in case a host died before it enabled
+	 * us. Hence, simply reset the keep alive timer when the controller
+	 * is enabled.
+	 */
+	mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
 }
 
 static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl)
-- 
2.14.1

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

end of thread, other threads:[~2018-06-20 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-19 12:45 [PATCH v2 1/2] nvmet: reset keep alive timer in controller enable Sagi Grimberg
2018-06-19 12:45 ` [PATCH v2 2/2] nvme: start keep alive timer when enabling the controller Sagi Grimberg
2018-06-20  9:06 ` [PATCH v2 1/2] nvmet: reset keep alive timer in controller enable Christoph Hellwig
2018-06-20  9:33   ` Max Gurtovoy
2018-06-20 10:41     ` Sagi Grimberg
2018-06-20 12:28       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox