From: Amit Engel Date: Wed, 19 Aug 2020 08:31:11 +0000 (+0300) Subject: nvmet: Disable keep-alive timer when kato is cleared to 0h X-Git-Tag: v5.4.64~123 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2c9bc7d9600c9eee934301b4f9ecf99f36a19085;p=users%2Fdwmw2%2Flinux.git nvmet: Disable keep-alive timer when kato is cleared to 0h [ Upstream commit 0d3b6a8d213a30387b5104b2fb25376d18636f23 ] Based on nvme spec, when keep alive timeout is set to zero the keep-alive timer should be disabled. Signed-off-by: Amit Engel Signed-off-by: Sagi Grimberg Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 57a4062cbb59e..7d7176369edf7 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -369,6 +369,9 @@ static void nvmet_keep_alive_timer(struct work_struct *work) static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl) { + if (unlikely(ctrl->kato == 0)) + return; + pr_debug("ctrl %d start keep-alive timer for %d secs\n", ctrl->cntlid, ctrl->kato); @@ -378,6 +381,9 @@ static void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl) static void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl) { + if (unlikely(ctrl->kato == 0)) + return; + pr_debug("ctrl %d stop keep-alive\n", ctrl->cntlid); cancel_delayed_work_sync(&ctrl->ka_work);