diff mbox

NFS: allow enough time for timeouts to run

Message ID 20110804062950.1A7B9813270B@regina.usersys.redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Max Matveev Aug. 4, 2011, 5:42 a.m. 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 <makc@redhat.com>
---
 fs/nfs/client.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff mbox

Patch

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)