Hi gang...
It would be great if people running NFS (soft, and hard mounts)
could give this diff a spin. what it does essentially is to redo
the retransmission booking by keeping count of maximum rexmits in
one place (the nfsmount structure) and kill deadthresh, (an nqnfs
left over); that causes a slight behaviour change when printing
the "not responding" message for dead servers (it does it now
a tad bit sooner then before (at 4 rexmits, not 9 iirc)).
this diff is first of a few to get the stale/dead nfs mount point
issued fixed.
Index: nfs/nfs.h
===================================================================
RCS file: /exports/cvs/src/sys/nfs/nfs.h,v
retrieving revision 1.38
diff -u -p -r1.38 nfs.h
--- nfs/nfs.h 24 Jan 2009 23:35:47 -0000 1.38
+++ nfs/nfs.h 20 May 2009 12:37:39 -0000
@@ -238,7 +238,6 @@ struct nfsreq {
struct vnode *r_vp;
u_int32_t r_xid;
int r_flags; /* flags on request, see below */
- int r_retry; /* max retransmission count */
int r_rexmit; /* current retrans count */
int r_timer; /* tick counter on reply */
int r_procnum; /* NFS procedure number */
Index: nfs/nfs_socket.c
===================================================================
RCS file: /exports/cvs/src/sys/nfs/nfs_socket.c,v
retrieving revision 1.79
diff -u -p -r1.79 nfs_socket.c
--- nfs/nfs_socket.c 15 May 2009 12:07:18 -0000 1.79
+++ nfs/nfs_socket.c 20 May 2009 15:12:03 -0000
@@ -877,10 +877,6 @@ nfs_request1(struct nfsreq *rep, struct
}
tryagain:
- if (nmp->nm_flag & NFSMNT_SOFT)
- rep->r_retry = nmp->nm_retry;
- else
- rep->r_retry = NFS_MAXREXMIT + 1; /* past clip limit */
rep->r_rtt = rep->r_rexmit = 0;
if (proct[rep->r_procnum] > 0)
rep->r_flags = R_TIMING;
@@ -1131,10 +1127,8 @@ nfs_rephead(siz, nd, slp, err, mrq, mbp)
}
/*
- * Nfs timer routine
- * Scan the nfsreq list and retranmit any requests that have timed out
- * To avoid retransmission attempts on STREAM sockets (in the future) make
- * sure to set the r_retry field to 0 (implies nm_retry == 0).
+ * nfs timer routine
+ * Scan the nfsreq list and retranmit any requests that have timed out.
*/
void
nfs_timer(arg)
@@ -1174,15 +1168,13 @@ nfs_timer(arg)
if (nmp->nm_timeouts < nitems(nfs_backoff))
nmp->nm_timeouts++;
}
- /*
- * Check for server not responding
- */
- if ((rep->r_flags & R_TPRINTFMSG) == 0 &&
- rep->r_rexmit > nmp->nm_deadthresh) {
+
+ /* Check for server not responding. */
+ if ((rep->r_flags & R_TPRINTFMSG) == 0 && rep->r_rexmit > 4) {
nfs_msg(rep, "not responding");
rep->r_flags |= R_TPRINTFMSG;
}
- if (rep->r_rexmit >= rep->r_retry) { /* too many */
+ if (rep->r_rexmit >= nmp->nm_retry) { /* too many */
nfsstats.rpctimeouts++;
rep->r_flags |= R_SOFTTERM;
continue;
@@ -1192,6 +1184,7 @@ nfs_timer(arg)
rep->r_rexmit = NFS_MAXREXMIT;
continue;
}
+
if ((so = nmp->nm_so) == NULL)
continue;
Index: nfs/nfs_vfsops.c
===================================================================
RCS file: /exports/cvs/src/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.81
diff -u -p -r1.81 nfs_vfsops.c
--- nfs/nfs_vfsops.c 13 Apr 2009 17:51:57 -0000 1.81
+++ nfs/nfs_vfsops.c 20 May 2009 14:17:29 -0000
@@ -67,9 +67,6 @@
#include <nfs/nfsdiskless.h>
#include <nfs/nfs_var.h>
-#define NQ_DEADTHRESH NQ_NEVERDEAD /* Default nm_deadthresh */
-#define NQ_NEVERDEAD 9 /* Greater than max. nm_timeouts */
-
extern struct nfsstats nfsstats;
extern int nfs_ticks;
extern u_int32_t nfs_procids[NFS_NPROCS];
@@ -443,11 +440,10 @@ nfs_decode_args(nmp, argp, nargp)
nmp->nm_timeo = NFS_MAXTIMEO;
}
- if ((argp->flags & NFSMNT_RETRANS) && argp->retrans > 1) {
- nmp->nm_retry = argp->retrans;
- if (nmp->nm_retry > NFS_MAXREXMIT)
- nmp->nm_retry = NFS_MAXREXMIT;
- }
+ if ((argp->flags & NFSMNT_RETRANS) && argp->retrans > 1)
+ nmp->nm_retry = MIN(argp->retrans, NFS_MAXREXMIT);
+ if (!(nmp->nm_flag & NFSMNT_SOFT))
+ nmp->nm_retry = NFS_MAXREXMIT + 1; /* past clip limit */
if (argp->flags & NFSMNT_NFSV3) {
if (argp->sotype == SOCK_DGRAM)
@@ -503,9 +499,6 @@ nfs_decode_args(nmp, argp, nargp)
if ((argp->flags & NFSMNT_READAHEAD) && argp->readahead >= 0 &&
argp->readahead <= NFS_MAXRAHEAD)
nmp->nm_readahead = argp->readahead;
- if ((argp->flags & NFSMNT_DEADTHRESH) && argp->deadthresh >= 1 &&
- argp->deadthresh <= NQ_NEVERDEAD)
- nmp->nm_deadthresh = argp->deadthresh;
if (argp->flags & NFSMNT_ACREGMIN && argp->acregmin >= 0) {
if (argp->acregmin > 0xffff)
nmp->nm_acregmin = 0xffff;
@@ -554,7 +547,6 @@ nfs_decode_args(nmp, argp, nargp)
nargp->retrans = nmp->nm_retry;
nargp->maxgrouplist = nmp->nm_numgrps;
nargp->readahead = nmp->nm_readahead;
- nargp->deadthresh = nmp->nm_deadthresh;
nargp->acregmin = nmp->nm_acregmin;
nargp->acregmax = nmp->nm_acregmax;
nargp->acdirmin = nmp->nm_acdirmin;
@@ -680,7 +672,6 @@ mountnfs(argp, mp, nam, pth, hst)
nmp->nm_readdirsize = NFS_READDIRSIZE;
nmp->nm_numgrps = NFS_MAXGRPS;
nmp->nm_readahead = NFS_DEFRAHEAD;
- nmp->nm_deadthresh = NQ_DEADTHRESH;
nmp->nm_fhsize = argp->fhsize;
nmp->nm_acregmin = NFS_MINATTRTIMO;
nmp->nm_acregmax = NFS_MAXATTRTIMO;
Index: nfs/nfsmount.h
===================================================================
RCS file: /exports/cvs/src/sys/nfs/nfsmount.h,v
retrieving revision 1.18
diff -u -p -r1.18 nfsmount.h
--- nfs/nfsmount.h 27 Dec 2008 14:14:30 -0000 1.18
+++ nfs/nfsmount.h 20 May 2009 12:37:50 -0000
@@ -62,7 +62,6 @@ struct nfsmount {
int nm_sent; /* Request send count */
int nm_cwnd; /* Request send window */
int nm_timeouts; /* Request timeouts */
- int nm_deadthresh; /* Threshold of timeouts-->dead server*/
int nm_rsize; /* Max size of read rpc */
int nm_wsize; /* Max size of write rpc */
int nm_readdirsize; /* Size of a readdir rpc */