From patchwork Tue Sep 8 15:22:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 264128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D107C433E2 for ; Tue, 8 Sep 2020 19:57:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20A5F207DE for ; Tue, 8 Sep 2020 19:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599595048; bh=ZD+Zo8xF+XpUoc8Fx//o1d9DC+eODxA0Wq+zXxf/Ne0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BMoTcvQ1Hf/0a3Q7nyHelLJZiyh3bRVdy7Z10P7qPRASlZPAobdcOc3942V5k/hXS gitsx+n/5Tx2TbgEEhn4hPEokmTcM9oJOegulaNTomJVkLvg6xMVrYyUH87edVG6e9 BbZ2sqWz9IgFTnz1Ciyf1vS5KfAOjmuRLyyCIa8w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732520AbgIHT5L (ORCPT ); Tue, 8 Sep 2020 15:57:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:58874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730538AbgIHPfu (ORCPT ); Tue, 8 Sep 2020 11:35:50 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C876E224D2; Tue, 8 Sep 2020 15:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579292; bh=ZD+Zo8xF+XpUoc8Fx//o1d9DC+eODxA0Wq+zXxf/Ne0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FogEujyN5qm5DOxfItU0VUyMvw2zxwZT177wt0cePHD8F5tK2oiy7wPKYub0ie71F NvTOjzM0XUzG6OrYOnTgljrqhyaDIhLG3JwjSYurxtaRLNtD2n4XXuVKvS23+q8Gd6 dNnxQCS35HkF7+fSi1gpW6aoxzLhG3AKR64I+Z4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amit Engel , Sagi Grimberg , Jens Axboe , Sasha Levin Subject: [PATCH 5.8 009/186] nvmet: Disable keep-alive timer when kato is cleared to 0h Date: Tue, 8 Sep 2020 17:22:31 +0200 Message-Id: <20200908152242.104264037@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152241.646390211@linuxfoundation.org> References: <20200908152241.646390211@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Amit Engel [ 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 --- drivers/nvme/target/core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 6e2f623e472e9..58b035cc67a01 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -396,6 +396,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); @@ -405,6 +408,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);