From patchwork Thu Aug 4 05:42:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Matveev X-Patchwork-Id: 1033942 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p746T4cM011971 for ; Thu, 4 Aug 2011 06:29:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750951Ab1HDG3w (ORCPT ); Thu, 4 Aug 2011 02:29:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34425 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837Ab1HDG3w (ORCPT ); Thu, 4 Aug 2011 02:29:52 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p746TpGC026085 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 4 Aug 2011 02:29:51 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p746Tpud026110 for ; Thu, 4 Aug 2011 02:29:51 -0400 Received: from regina.usersys.redhat.com (dhcp-176-225.mel.redhat.com [10.64.176.225]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p746ToGj029498 for ; Thu, 4 Aug 2011 02:29:50 -0400 Received: by regina.usersys.redhat.com (Postfix, from userid 500) id 1A7B9813270B; Thu, 4 Aug 2011 16:29:50 +1000 (EST) In-Reply-To: <20026.13331.411712.805796@regina.usersys.redhat.com> References: <20026.13331.411712.805796@regina.usersys.redhat.com> From: Max Matveev Date: Thu, 4 Aug 2011 15:42:26 +1000 Subject: [PATCH] NFS: allow enough time for timeouts to run To: linux-nfs@vger.kernel.org Message-Id: <20110804062950.1A7B9813270B@regina.usersys.redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 04 Aug 2011 06:29:53 +0000 (UTC) NFS/TCP uses linear backoff when retransmiting requests but miscalculates the cut-off time for the timeout sequence resulting in premature major timeouts. The cutoff should be the sum of first retransmits+1 numbers multiplied by the timeo, not the retransmits+1 multiplied by timeo. Signed-off-by: Max Matveev --- fs/nfs/client.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 5833fbb..3d12d10 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -604,7 +604,8 @@ static void nfs_init_timeout_values(struct rpc_timeout *to, int proto, if (to->to_initval > NFS_MAX_TCP_TIMEOUT) to->to_initval = NFS_MAX_TCP_TIMEOUT; to->to_increment = to->to_initval; - to->to_maxval = to->to_initval + (to->to_increment * to->to_retries); + to->to_maxval = (to->to_retries + 1) * (to->to_retries + 2) / 2; + to->to_maxval *= to->to_initval; if (to->to_maxval > NFS_MAX_TCP_TIMEOUT) to->to_maxval = NFS_MAX_TCP_TIMEOUT; if (to->to_maxval < to->to_initval)