Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1059262pxk; Mon, 31 Aug 2020 08:43:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyqylANHBybWcinMfiM8ZYeCPqACFGyDSzG6uPUJMMIUvK73yFaLJ70BeWbf+H+pvvOSze X-Received: by 2002:a17:906:2acf:: with SMTP id m15mr1695730eje.257.1598888599553; Mon, 31 Aug 2020 08:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598888599; cv=none; d=google.com; s=arc-20160816; b=NhzC94wBDEFQTZsk1+OCgnlHQ3lS9Bxb91DiimgJri4t+USD61aiciRfNq27Z5ov71 0tfHNzdproAHy6CVlAFq6reLSDrlpyYtLiAjW8Gl4X1tv6x85rzgnaVp6HiG/ZlvTE2v laSutlpxMh4Xed6+Z1DXn0QwRJZIG3p68S2yfGJOmIG9J7i5ItA9PmNkghJOEXd71Lk/ 7nYJ7LZaRxF5MRQbmUE1saaw8WLyF6L/mDIbbEEE9z3VRaHt6ptp4dNpTF2ePfGbd/mA ZD4wp/13eBpNZE4TfqfD/Hef1uQ2vUQ3S4klxntZN2gGUEZjNFyQFfejEb98LKbF+qHo IZBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KTqWlfeOQflK5Y0OFs2CFBESQtZdeTeklxd6+a+rpps=; b=TkROzpzj9K9OdsrSZ+sbVfnuQJ5bqFIwz4aXcR3RoQk5g1gEp+IiFaJ1tLkLYo97qV pLZdmw9MQLHWufrk2wCSZLgz+xazijE65fhiDrSuf/CLxISYTJ85thRnJ99R8CtvzM9t ixL/nw5Z4TggCMMWxXjSZ3MKLgkqCmeEBJXVDIuh+yM3uuyZiPXbtPLSITfk8pvFDxlG 0jjaJB+FKqTDZoA3hjt0xjxGrH6OTRYW1N0/4UWfWvU3JNpSN7Mtu3DINlZt3kijYP2m bp1NfTt9kh1JKA38pbuoI2ObKiq4fF0yJse4gBK2rnrwLpyMS6A9WDLGTLVVIjx04o04 984w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OQVuDuKe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si504727edh.74.2020.08.31.08.42.56; Mon, 31 Aug 2020 08:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OQVuDuKe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729133AbgHaPkh (ORCPT + 99 others); Mon, 31 Aug 2020 11:40:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:38882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728476AbgHaP3y (ORCPT ); Mon, 31 Aug 2020 11:29:54 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9273B214DB; Mon, 31 Aug 2020 15:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598887794; bh=ZD+Zo8xF+XpUoc8Fx//o1d9DC+eODxA0Wq+zXxf/Ne0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQVuDuKe/jnFG6rQuFn/TV9t25vLKARUosVPc6loQXVUnQP0645O4vGEbxxz598uF UOf0itUgeyqrQzhX9cE5ZL94Gm3K41upMqWxqGMnxsEsfrvr+VrvvcUx2apc+dFBmh yyO5isyQGeY47kGSGvY0f4v2yakZicmvmnmBS+wg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Amit Engel , Sagi Grimberg , Jens Axboe , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.8 12/42] nvmet: Disable keep-alive timer when kato is cleared to 0h Date: Mon, 31 Aug 2020 11:29:04 -0400 Message-Id: <20200831152934.1023912-12-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831152934.1023912-1-sashal@kernel.org> References: <20200831152934.1023912-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); -- 2.25.1