Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3037988pxj; Mon, 17 May 2021 16:10:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYT009/uVbtfwuLpSnQlZUbVd4WilDcd+C/HgULXKgDQs2iVV0QDDO48baBz7GuFUkZWfY X-Received: by 2002:a05:6402:48f:: with SMTP id k15mr2986401edv.262.1621293041185; Mon, 17 May 2021 16:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621293041; cv=none; d=google.com; s=arc-20160816; b=eRbxgWC/bU39c/aDeq2FZeHYX5Y+tr4LO6jHqfcO4NPDFjW5izJuw4McJo+6ChAGVt cIRSnlt1xipn+zIF7EK9IdDpnrVyCfIdnFYWamFNSOckj3GcCOUIVNMwrR9tl6MGkGYP CY7ne874rkGHqYDyARSe60rAceNpI+XOJGoevPEmUUPA6vTGyexUTRGfNUnv0cAZSOWm OCdC1dmBKvhyknluxkJq8Ibiq7RD6oIGwxtlvkanWyD1kOmB/ec21JE0uPXmVN8KzEuv YylO3+bx7YROo2ybpR6/dxy9Lxs2h8dDxiThiDCglJm83vEhydxJ//zZKWXpspsLwyFx G0yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FKKbbcLShBgjih48wMWUcjaGUJZ8kWy5EQJ/hjbAy54=; b=R+r5Iq+u2dBViuByb8fLoxd309DILtNW5b0gIxtMcrLAnXoL+11Ifr1aJKUsHih0+K dG2pEJiFoG/rY24SQKrhIZaYEop/fa/0oCmu7deHR8MVTsq4W5rPzisH8v4TmE8vdEkr CnWzNEnp1Cr1iFT2qcbx6c33r8gMT8eRRWR4AMjeVHXhKpxsFpdALiKXhEbn6SuiRUO5 NZKY+La4+83cHEZJWANcCXlpT+BoqRnaiFP947WBAkVqLvGd3naX+6Ru82bkWos0L9hO PHxKG+RKcM2FL/P/luimsTrWKsBw4WgrpyYEMBAYPWEDVthdx/1GP3sFEe9W55zOG8Go PsZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pg9I+AtJ; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r10si16832916ejy.100.2021.05.17.16.10.13; Mon, 17 May 2021 16:10:41 -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=@linuxfoundation.org header.s=korg header.b=Pg9I+AtJ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239048AbhEQOVT (ORCPT + 99 others); Mon, 17 May 2021 10:21:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:49986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235734AbhEQOSA (ORCPT ); Mon, 17 May 2021 10:18:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBD656139A; Mon, 17 May 2021 14:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260616; bh=3IjUhckdqDInYS9wKOMOIf9azJ1uG6SRWO0KmbO6Dts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pg9I+AtJllNxgK78P8+RqEFDQf22yiBSg7DGZvsUfSahkBteNgHtVQ1XO7VFc11Xf 4+QwwFQnWfQmmQBdSna5FlN1oy9TAzzcA1KbFWUe6s31ilfn3P+UfgjLIdFvCdrjlz RVNAiZaQUTSZCZ04Zdz8lb87CGjvIWCU1u3IxQnA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Dion , Trond Myklebust , Sasha Levin Subject: [PATCH 5.12 162/363] SUNRPC: Handle major timeout in xprt_adjust_timeout() Date: Mon, 17 May 2021 16:00:28 +0200 Message-Id: <20210517140308.080471762@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Dion [ Upstream commit 09252177d5f924f404551b4b4eded5daa7f04a3a ] Currently if a major timeout value is reached, but the minor value has not been reached, an ETIMEOUT will not be sent back to the caller. This can occur if the v4 server is not responding to requests and retrans is configured larger than the default of two. For example, A TCP mount with a configured timeout value of 50 and a retransmission count of 3 to a v4 server which is not responding: 1. Initial value and increment set to 5s, maxval set to 20s, retries at 3 2. Major timeout is set to 20s, minor timeout set to 5s initially 3. xport_adjust_timeout() is called after 5s, retry with 10s timeout, minor timeout is bumped to 10s 4. And again after another 10s, 15s total time with minor timeout set to 15s 5. After 20s total time xport_adjust_timeout is called as major timeout is reached, but skipped because the minor timeout is not reached - After this time the cpu spins continually calling xport_adjust_timeout() and returning 0 for 10 seconds. As seen on perf sched: 39243.913182 [0005] mount.nfs[3794] 4607.938 0.017 9746.863 6. This continues until the 15s minor timeout condition is reached (in this case for 10 seconds). After which the ETIMEOUT is processed back to the caller, the cpu spinning stops, and normal operations continue Fixes: 7de62bc09fe6 ("SUNRPC dont update timeout value on connection reset") Signed-off-by: Chris Dion Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- net/sunrpc/xprt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 11ebe8a127b8..20fe31b1b776 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -698,9 +698,9 @@ int xprt_adjust_timeout(struct rpc_rqst *req) const struct rpc_timeout *to = req->rq_task->tk_client->cl_timeout; int status = 0; - if (time_before(jiffies, req->rq_minortimeo)) - return status; if (time_before(jiffies, req->rq_majortimeo)) { + if (time_before(jiffies, req->rq_minortimeo)) + return status; if (to->to_exponential) req->rq_timeout <<= 1; else -- 2.30.2