From patchwork Mon Aug 3 12:18:20 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: 266785 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=-13.0 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=unavailable 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 E0C4DC433E1 for ; Mon, 3 Aug 2020 12:55:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B35132076E for ; Mon, 3 Aug 2020 12:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596459315; bh=AB1GOzwm2E2E0Yl0goh/dXH0EQ+cwG3ys/pu9d9QFxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tQkAaZRrWuNqx6osjrxUKVq7nwadb12xsv/11aKI+9GWYh6hhkHME/5Jj0UC03Eua 6MSJm6KKX4oDBWKEdqihTnV2H0SbtnzAc4OvOh/vQEhKPYhQucIVRX5QmEYgMXiNNK UDfiBDjGCBrQq4Hho9jUbX/GJ8BceZBcW9Bta5Dk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726986AbgHCMWt (ORCPT ); Mon, 3 Aug 2020 08:22:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:46568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727109AbgHCMWr (ORCPT ); Mon, 3 Aug 2020 08:22:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1B2BC20738; Mon, 3 Aug 2020 12:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596457366; bh=AB1GOzwm2E2E0Yl0goh/dXH0EQ+cwG3ys/pu9d9QFxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MuWOS9FlGPvMGmWX3gH41riC/mcfDB6DwZ2liXuLulJzpIO9snvKxpGTmV4wHUBOP dL5zNei5s7AmUOumfYHbR7/qK9r9Mhq/mWOCl3tGtvKloHnZfx0u+eMrGPB3jifN8v avBbBjwIs6VAS6cpfhClwJBJDWY4nVry9qw4RNac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.7 042/120] nvme-tcp: fix possible hang waiting for icresp response Date: Mon, 3 Aug 2020 14:18:20 +0200 Message-Id: <20200803121904.863311216@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200803121902.860751811@linuxfoundation.org> References: <20200803121902.860751811@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: Sagi Grimberg [ Upstream commit adc99fd378398f4c58798a1c57889872967d56a6 ] If the controller died exactly when we are receiving icresp we hang because icresp may never return. Make sure to set a high finite limit. Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver") Signed-off-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/tcp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 4862fa962011d..26461bf3fdcc3 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1392,6 +1392,9 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, } } + /* Set 10 seconds timeout for icresp recvmsg */ + queue->sock->sk->sk_rcvtimeo = 10 * HZ; + queue->sock->sk->sk_allocation = GFP_ATOMIC; nvme_tcp_set_queue_io_cpu(queue); queue->request = NULL;