summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2006-09-20 21:56:22 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2006-09-20 21:56:22 +0000
commit901d27dd839579369a4332191e3bf97b22732ff5 (patch)
tree1e0d023f6fdf980bca22b1e38c0a9e401fa4c0c1
parent8d6561e1c3895a7f1885a1af2219f61c6d54308e (diff)
Fix the way delays between request retransmissions are calculated
in the case where NFSERR_TRYLATER is received from the server. Adapted from NetBSD. ok pedro@, tedu@
-rw-r--r--sys/nfs/nfs.h3
-rw-r--r--sys/nfs/nfs_socket.c13
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index 67ade9fc871..e5b8ed9de94 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.h,v 1.26 2006/05/29 16:49:42 avsm Exp $ */
+/* $OpenBSD: nfs.h,v 1.27 2006/09/20 21:56:21 thib Exp $ */
/* $NetBSD: nfs.h,v 1.10.4.1 1996/05/27 11:23:56 fvdl Exp $ */
/*
@@ -49,6 +49,7 @@
#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/
+#define NFS_TIMEOUTMUL 2 /* Timeout/Delay multiplier */
#define NFS_MAXREXMIT 100 /* Stop counting after this many */
#define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */
#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 74b88487179..cb0416b45d8 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.44 2006/08/04 12:35:57 pedro Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.45 2006/09/20 21:56:21 thib Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -843,12 +843,14 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
time_t reqtime, waituntil;
caddr_t dpos, cp2;
int t1, s, error = 0, mrest_len, auth_len, auth_type;
- int trylater_delay = 15, trylater_cnt = 0, failed_auth = 0;
+ int trylater_delay, failed_auth = 0;
int verf_len, verf_type;
u_int32_t xid;
char *auth_str, *verf_str;
NFSKERBKEY_T key; /* save session key */
+ trylater_delay = NFS_MINTIMEO;
+
nmp = VFSTONFS(vp->v_mount);
rep = pool_get(&nfsreqpl, PR_WAITOK);
rep->r_nmp = nmp;
@@ -1043,9 +1045,10 @@ tryagain:
while (time_second < waituntil)
(void) tsleep((caddr_t)&lbolt,
PSOCK, "nqnfstry", 0);
- trylater_delay *= nfs_backoff[trylater_cnt];
- if (trylater_cnt < 7)
- trylater_cnt++;
+ trylater_delay *= NFS_TIMEOUTMUL;
+ if (trylater_delay > NFS_MAXTIMEO)
+ trylater_delay = NFS_MAXTIMEO;
+
goto tryagain;
}