* [PATCH] nvmet: handle keep-alive timer when kato is modified by a set features cmd
@ 2020-09-16 17:47 amit.engel
2020-09-16 19:53 ` Sagi Grimberg
2020-09-17 8:55 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: amit.engel @ 2020-09-16 17:47 UTC (permalink / raw)
To: sagi, linux-nvme; +Cc: Amit
From: Amit <amit.engel@emc.com>
A user may modify the kato by a set features cmd,
In that case, the right flow is:
- cancel the timer
- update kato to the new value
- start the timer again
Signed-off-by: Amit Engel <amit.engel@dell.com>
---
drivers/nvme/target/admin-cmd.c | 2 ++
drivers/nvme/target/core.c | 4 ++--
drivers/nvme/target/nvmet.h | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index e9fe91786bbb..dca34489a1dc 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -727,7 +727,9 @@ u16 nvmet_set_feat_kato(struct nvmet_req *req)
{
u32 val32 = le32_to_cpu(req->cmd->common.cdw11);
+ nvmet_stop_keep_alive_timer(req->sq->ctrl);
req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000);
+ nvmet_start_keep_alive_timer(req->sq->ctrl);
nvmet_set_result(req, req->sq->ctrl->kato);
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index c052c922853a..40861d303335 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -395,7 +395,7 @@ static void nvmet_keep_alive_timer(struct work_struct *work)
nvmet_ctrl_fatal_error(ctrl);
}
-static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
+void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
{
if (unlikely(ctrl->kato == 0))
return;
@@ -407,7 +407,7 @@ static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
}
-static void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl)
+void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl)
{
if (unlikely(ctrl->kato == 0))
return;
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 47ee3fb193bd..559a15ccc322 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -395,6 +395,8 @@ void nvmet_get_feat_async_event(struct nvmet_req *req);
u16 nvmet_set_feat_kato(struct nvmet_req *req);
u16 nvmet_set_feat_async_event(struct nvmet_req *req, u32 mask);
void nvmet_execute_async_event(struct nvmet_req *req);
+void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl);
+void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl);
u16 nvmet_parse_connect_cmd(struct nvmet_req *req);
void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id);
--
2.16.5
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmet: handle keep-alive timer when kato is modified by a set features cmd
2020-09-16 17:47 [PATCH] nvmet: handle keep-alive timer when kato is modified by a set features cmd amit.engel
@ 2020-09-16 19:53 ` Sagi Grimberg
2020-09-17 8:55 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2020-09-16 19:53 UTC (permalink / raw)
To: amit.engel, linux-nvme
> From: Amit <amit.engel@emc.com>
Can you please make sure your author reference has first
and last name (that matches your Signed-of-by).
>
> A user may modify the kato by a set features cmd,
> In that case, the right flow is:
> - cancel the timer
> - update kato to the new value
> - start the timer again
>
> Signed-off-by: Amit Engel <amit.engel@dell.com>
Besides that,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmet: handle keep-alive timer when kato is modified by a set features cmd
2020-09-16 17:47 [PATCH] nvmet: handle keep-alive timer when kato is modified by a set features cmd amit.engel
2020-09-16 19:53 ` Sagi Grimberg
@ 2020-09-17 8:55 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-09-17 8:55 UTC (permalink / raw)
To: amit.engel; +Cc: sagi, linux-nvme
Applied to nvme-5.10 with an updated changelog and the author line made
to match the signoff.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-17 8:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 17:47 [PATCH] nvmet: handle keep-alive timer when kato is modified by a set features cmd amit.engel
2020-09-16 19:53 ` Sagi Grimberg
2020-09-17 8:55 ` Christoph Hellwig
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.