Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp442463pxj; Tue, 18 May 2021 06:55:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFH8y6JQGTKCHCd+Brv/Lynj4y8zeUmbuWNHnMYts32XKSp6Zxsq82smL7JIUuGqEtKea2 X-Received: by 2002:a17:906:f01:: with SMTP id z1mr6057569eji.535.1621346106846; Tue, 18 May 2021 06:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621346106; cv=none; d=google.com; s=arc-20160816; b=pcm0hViGlg28ovF66gIKq5hVWY6yNJxNiHrB9bEr4B52RuLwmod6oMW3is72PA46/4 xoDSuWpaigRauaqJTBiAJpRKp0TRFrXduMry8DLiecPnL1TuqxgeEhmytWtuhbC6eFMs a2SzYgrU+hlO73jiR7ST6DS7hrzZMHDEffNEZoWyzi/RCz6JbWq/6+uVyiQOG1kN+nPS 7TD+JiVEsBNHtTTIQ4F80CaZwEEigH2/j9owHI1zjTdUsuBgmUF4PXcCvm2Szspl6FD3 hanqKwPBz84LSY9EuvJcKMRleqWkXxqlWPiHy5F5SORvLyzlDg63IR6mHbxEW8oEr/5Y 2w9Q== 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=3DnCB0tHl4CIFp4dpEd2yjYY0QB6Gq2JeyGhkNfVOY4=; b=rYDpJP0NV56mPPfdH8Ww6wdz0HH7nsLMO3zghBhHBrNflwQWbRTfl33N/ixppb13jf 7UrfuNSOKf0Y6+aWrqxeXb8qcq28z2B5fPEV9Vb8Pn9pP2sSu1LyvJfYLtj4VE90WNfm OWBQLIc9wN5e+tFJLF3SypLXaD2UphpbhjCKoY1Q881JJ/NHyeiCaWEH3vL5wvmnCu7x auvZkCLEr7wz7lCC7Zz1XhOnT0tDuS14StQRhUhzrsOQ6IBA3fr3fpk5RTSwN2++e5KD MiQcC4A9Tl7fDdP4iaXPk3MrURi8Zkyz5d+e+CNpdbWj3M3p72bmWnMcoL4aN/IUPItA LmtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IosxvVo2; 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 q20si21005985ejb.629.2021.05.18.06.54.41; Tue, 18 May 2021 06:55:06 -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=IosxvVo2; 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 S243410AbhEQPkW (ORCPT + 99 others); Mon, 17 May 2021 11:40:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:43806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242428AbhEQPZe (ORCPT ); Mon, 17 May 2021 11:25:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 984AF61407; Mon, 17 May 2021 14:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262169; bh=cDZiA5CNFv8pEc/Tbm2AsquWnaaCF709FSptd3+wCt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IosxvVo2T5HPbJagK9jTNvpCC8YiybDiog3RDEprAyHlrSHYo8cAWDoZYjpx8nrZ0 05H5Pwdy7pP4/OuVvF67dyBnMCfuq8cNr3M8v0Tz+24G9kkELCsAP7d96WaPl2nFI8 cdOWaQnivo8AiAZn2SIKoI0NwtbqzDMXAndkLaW8= 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.10 125/289] SUNRPC: Handle major timeout in xprt_adjust_timeout() Date: Mon, 17 May 2021 16:00:50 +0200 Message-Id: <20210517140309.367685801@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 586bc9d98de1..a85759d8cde8 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -670,9 +670,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