summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
Diffstat (limited to 'sys/nfsserver')
-rw-r--r--sys/nfsserver/nfs.h61
-rw-r--r--sys/nfsserver/nfs_srvsock.c69
-rw-r--r--sys/nfsserver/nfs_srvsubs.c49
-rw-r--r--sys/nfsserver/nfs_syscalls.c37
-rw-r--r--sys/nfsserver/nfsrvstats.h61
5 files changed, 170 insertions, 107 deletions
diff --git a/sys/nfsserver/nfs.h b/sys/nfsserver/nfs.h
index 8b28c00..ad606ad 100644
--- a/sys/nfsserver/nfs.h
+++ b/sys/nfsserver/nfs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $Id: nfs.h,v 1.33 1998/02/01 21:23:29 bde Exp $
+ * $Id: nfs.h,v 1.34 1998/03/30 09:53:43 phk Exp $
*/
#ifndef _NFS_NFS_H_
@@ -56,11 +56,17 @@
#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
#define NFS_MAXGRPS 16 /* Max. size of groups list */
#ifndef NFS_MINATTRTIMO
-#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
+#define NFS_MINATTRTIMO 3 /* VREG attrib cache timeout in sec */
#endif
#ifndef NFS_MAXATTRTIMO
#define NFS_MAXATTRTIMO 60
#endif
+#ifndef NFS_MINDIRATTRTIMO
+#define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */
+#endif
+#ifndef NFS_MAXDIRATTRTIMO
+#define NFS_MAXDIRATTRTIMO 60
+#endif
#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
#define NFS_READDIRSIZE 8192 /* Def. readdir size */
@@ -104,15 +110,6 @@
#endif
/*
- * Set the attribute timeout based on how recently the file has been modified.
- */
-#define NFS_ATTRTIMEO(np) \
- ((((np)->n_flag & NMODIFIED) || \
- (time_second - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
- ((time_second - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
- (time_second - (np)->n_mtime) / 10))
-
-/*
* Expected allocation sizes for major data structures. If the actual size
* of the structure exceeds these sizes, then malloc() will be allocating
* almost twice the memory required. This is used in nfs_init() to warn
@@ -149,6 +146,10 @@ struct nfs_args {
int leaseterm; /* Term (sec) of lease */
int deadthresh; /* Retrans threshold */
char *hostname; /* server's name */
+ int acregmin; /* cache attrs for reg files min time */
+ int acregmax; /* cache attrs for reg files max time */
+ int acdirmin; /* cache attrs for dirs min time */
+ int acdirmax; /* cache attrs for dirs max time */
};
/*
@@ -172,21 +173,25 @@ struct nfs_args {
#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
-#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */
-#define NFSMNT_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
-#define NFSMNT_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */
-#define NFSMNT_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
-#define NFSMNT_MNTD 0x00200000 /* Mnt server for mnt point */
-#define NFSMNT_DISMINPROG 0x00400000 /* Dismount in progress */
-#define NFSMNT_DISMNT 0x00800000 /* Dismounted */
-#define NFSMNT_SNDLOCK 0x01000000 /* Send socket lock */
-#define NFSMNT_WANTSND 0x02000000 /* Want above */
-#define NFSMNT_RCVLOCK 0x04000000 /* Rcv socket lock */
-#define NFSMNT_WANTRCV 0x08000000 /* Want above */
-#define NFSMNT_WAITAUTH 0x10000000 /* Wait for authentication */
-#define NFSMNT_HASAUTH 0x20000000 /* Has authenticator */
-#define NFSMNT_WANTAUTH 0x40000000 /* Wants an authenticator */
-#define NFSMNT_AUTHERR 0x80000000 /* Authentication error */
+#define NFSMNT_ACREGMIN 0x00040000
+#define NFSMNT_ACREGMAX 0x00080000
+#define NFSMNT_ACDIRMIN 0x00100000
+#define NFSMNT_ACDIRMAX 0x00200000
+
+#define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
+#define NFSSTA_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */
+#define NFSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
+#define NFSSTA_MNTD 0x00200000 /* Mnt server for mnt point */
+#define NFSSTA_DISMINPROG 0x00400000 /* Dismount in progress */
+#define NFSSTA_DISMNT 0x00800000 /* Dismounted */
+#define NFSSTA_SNDLOCK 0x01000000 /* Send socket lock */
+#define NFSSTA_WANTSND 0x02000000 /* Want above */
+#define NFSSTA_RCVLOCK 0x04000000 /* Rcv socket lock */
+#define NFSSTA_WANTRCV 0x08000000 /* Want above */
+#define NFSSTA_WAITAUTH 0x10000000 /* Wait for authentication */
+#define NFSSTA_HASAUTH 0x20000000 /* Has authenticator */
+#define NFSSTA_WANTAUTH 0x40000000 /* Wants an authenticator */
+#define NFSSTA_AUTHERR 0x80000000 /* Authentication error */
/*
* Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
@@ -580,8 +585,8 @@ int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
int, int, u_quad_t *, struct mbuf **, struct mbuf **,
caddr_t *));
-int nfs_sndlock __P((int *, struct nfsreq *));
-void nfs_sndunlock __P((int *flagp));
+int nfs_sndlock __P((int *, int *, struct nfsreq *));
+void nfs_sndunlock __P((int *, int *));
int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
int));
diff --git a/sys/nfsserver/nfs_srvsock.c b/sys/nfsserver/nfs_srvsock.c
index 5c084b7..3fe0cec 100644
--- a/sys/nfsserver/nfs_srvsock.c
+++ b/sys/nfsserver/nfs_srvsock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_socket.c,v 1.30 1997/10/28 15:59:07 bde Exp $
+ * $Id: nfs_socket.c,v 1.31 1998/03/30 09:54:04 phk Exp $
*/
/*
@@ -136,7 +136,7 @@ struct nfsrtt nfsrtt;
static int nfs_msg __P((struct proc *,char *,char *));
static int nfs_rcvlock __P((struct nfsreq *));
-static void nfs_rcvunlock __P((int *flagp));
+static void nfs_rcvunlock __P((int *flagp, int *statep));
static void nfs_realign __P((struct mbuf *m, int hsiz));
static int nfs_receive __P((struct nfsreq *rep, struct sockaddr **aname,
struct mbuf **mp));
@@ -483,7 +483,8 @@ nfs_receive(rep, aname, mp)
* until we have an entire rpc request/reply.
*/
if (sotype != SOCK_DGRAM) {
- error = nfs_sndlock(&rep->r_nmp->nm_flag, rep);
+ error = nfs_sndlock(&rep->r_nmp->nm_flag, &rep->r_nmp->nm_state,
+ rep);
if (error)
return (error);
tryagain:
@@ -497,14 +498,16 @@ tryagain:
* mount point.
*/
if (rep->r_mrep || (rep->r_flags & R_SOFTTERM)) {
- nfs_sndunlock(&rep->r_nmp->nm_flag);
+ nfs_sndunlock(&rep->r_nmp->nm_flag,
+ &rep->r_nmp->nm_state);
return (EINTR);
}
so = rep->r_nmp->nm_so;
if (!so) {
error = nfs_reconnect(rep);
if (error) {
- nfs_sndunlock(&rep->r_nmp->nm_flag);
+ nfs_sndunlock(&rep->r_nmp->nm_flag,
+ &rep->r_nmp->nm_state);
return (error);
}
goto tryagain;
@@ -516,13 +519,14 @@ tryagain:
if (error) {
if (error == EINTR || error == ERESTART ||
(error = nfs_reconnect(rep))) {
- nfs_sndunlock(&rep->r_nmp->nm_flag);
+ nfs_sndunlock(&rep->r_nmp->nm_flag,
+ &rep->r_nmp->nm_state);
return (error);
}
goto tryagain;
}
}
- nfs_sndunlock(&rep->r_nmp->nm_flag);
+ nfs_sndunlock(&rep->r_nmp->nm_flag, &rep->r_nmp->nm_state);
if (sotype == SOCK_STREAM) {
aio.iov_base = (caddr_t) &len;
aio.iov_len = sizeof(u_long);
@@ -621,7 +625,8 @@ errout:
"receive error %d from nfs server %s\n",
error,
rep->r_nmp->nm_mountp->mnt_stat.f_mntfromname);
- error = nfs_sndlock(&rep->r_nmp->nm_flag, rep);
+ error = nfs_sndlock(&rep->r_nmp->nm_flag,
+ &rep->r_nmp->nm_state, rep);
if (!error)
error = nfs_reconnect(rep);
if (!error)
@@ -704,7 +709,7 @@ nfs_reply(myrep)
* Get the next Rpc reply off the socket
*/
error = nfs_receive(myrep, &nam, &mrep);
- nfs_rcvunlock(&nmp->nm_flag);
+ nfs_rcvunlock(&nmp->nm_flag, &nmp->nm_state);
if (error) {
/*
@@ -964,12 +969,12 @@ tryagain:
nmp->nm_sent < nmp->nm_cwnd)) {
splx(s);
if (nmp->nm_soflags & PR_CONNREQUIRED)
- error = nfs_sndlock(&nmp->nm_flag, rep);
+ error = nfs_sndlock(&nmp->nm_flag, &nmp->nm_state, rep);
if (!error) {
m = m_copym(m, 0, M_COPYALL, M_WAIT);
error = nfs_send(nmp->nm_so, nmp->nm_nam, m, rep);
if (nmp->nm_soflags & PR_CONNREQUIRED)
- nfs_sndunlock(&nmp->nm_flag);
+ nfs_sndunlock(&nmp->nm_flag, &nmp->nm_state);
}
if (!error && (rep->r_flags & R_MUSTRESEND) == 0) {
nmp->nm_sent += NFS_CWNDSCALE;
@@ -1445,8 +1450,9 @@ nfs_sigintr(nmp, rep, p)
* in progress when a reconnect is necessary.
*/
int
-nfs_sndlock(flagp, rep)
+nfs_sndlock(flagp, statep, rep)
register int *flagp;
+ register int *statep;
struct nfsreq *rep;
{
struct proc *p;
@@ -1458,18 +1464,18 @@ nfs_sndlock(flagp, rep)
slpflag = PCATCH;
} else
p = (struct proc *)0;
- while (*flagp & NFSMNT_SNDLOCK) {
+ while (*statep & NFSSTA_SNDLOCK) {
if (nfs_sigintr(rep->r_nmp, rep, p))
return (EINTR);
- *flagp |= NFSMNT_WANTSND;
- (void) tsleep((caddr_t)flagp, slpflag | (PZERO - 1), "nfsndlck",
- slptimeo);
+ *statep |= NFSSTA_WANTSND;
+ (void) tsleep((caddr_t)flagp, slpflag | (PZERO - 1),
+ "nfsndlck", slptimeo);
if (slpflag == PCATCH) {
slpflag = 0;
slptimeo = 2 * hz;
}
}
- *flagp |= NFSMNT_SNDLOCK;
+ *statep |= NFSSTA_SNDLOCK;
return (0);
}
@@ -1477,15 +1483,16 @@ nfs_sndlock(flagp, rep)
* Unlock the stream socket for others.
*/
void
-nfs_sndunlock(flagp)
+nfs_sndunlock(flagp, statep)
register int *flagp;
+ register int *statep;
{
- if ((*flagp & NFSMNT_SNDLOCK) == 0)
+ if ((*statep & NFSSTA_SNDLOCK) == 0)
panic("nfs sndunlock");
- *flagp &= ~NFSMNT_SNDLOCK;
- if (*flagp & NFSMNT_WANTSND) {
- *flagp &= ~NFSMNT_WANTSND;
+ *statep &= ~NFSSTA_SNDLOCK;
+ if (*statep & NFSSTA_WANTSND) {
+ *statep &= ~NFSSTA_WANTSND;
wakeup((caddr_t)flagp);
}
}
@@ -1495,16 +1502,17 @@ nfs_rcvlock(rep)
register struct nfsreq *rep;
{
register int *flagp = &rep->r_nmp->nm_flag;
+ register int *statep = &rep->r_nmp->nm_state;
int slpflag, slptimeo = 0;
if (*flagp & NFSMNT_INT)
slpflag = PCATCH;
else
slpflag = 0;
- while (*flagp & NFSMNT_RCVLOCK) {
+ while (*statep & NFSSTA_RCVLOCK) {
if (nfs_sigintr(rep->r_nmp, rep, rep->r_procp))
return (EINTR);
- *flagp |= NFSMNT_WANTRCV;
+ *statep |= NFSSTA_WANTRCV;
(void) tsleep((caddr_t)flagp, slpflag | (PZERO - 1), "nfsrcvlk",
slptimeo);
/*
@@ -1520,7 +1528,7 @@ nfs_rcvlock(rep)
slptimeo = 2 * hz;
}
}
- *flagp |= NFSMNT_RCVLOCK;
+ *statep |= NFSSTA_RCVLOCK;
return (0);
}
@@ -1528,15 +1536,16 @@ nfs_rcvlock(rep)
* Unlock the stream socket for others.
*/
static void
-nfs_rcvunlock(flagp)
+nfs_rcvunlock(flagp, statep)
register int *flagp;
+ register int *statep;
{
- if ((*flagp & NFSMNT_RCVLOCK) == 0)
+ if ((*statep & NFSSTA_RCVLOCK) == 0)
panic("nfs rcvunlock");
- *flagp &= ~NFSMNT_RCVLOCK;
- if (*flagp & NFSMNT_WANTRCV) {
- *flagp &= ~NFSMNT_WANTRCV;
+ *statep &= ~NFSSTA_RCVLOCK;
+ if (*statep & NFSSTA_WANTRCV) {
+ *statep &= ~NFSSTA_WANTRCV;
wakeup((caddr_t)flagp);
}
}
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c
index f9eabdd..b81eedf 100644
--- a/sys/nfsserver/nfs_srvsubs.c
+++ b/sys/nfsserver/nfs_srvsubs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.52 1998/03/30 09:54:12 phk Exp $
+ * $Id: nfs_subs.c,v 1.53 1998/04/06 11:41:07 phk Exp $
*/
/*
@@ -1363,6 +1363,12 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
return (0);
}
+#ifdef NFS_ACDEBUG
+#include <sys/sysctl.h>
+static int nfs_acdebug;
+SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, "");
+#endif
+
/*
* Check the time stamp
* If the cache is valid, copy contents to *vap and return 0
@@ -1373,15 +1379,50 @@ nfs_getattrcache(vp, vaper)
register struct vnode *vp;
struct vattr *vaper;
{
- register struct nfsnode *np = VTONFS(vp);
+ register struct nfsnode *np;
register struct vattr *vap;
+ struct nfsmount *nmp;
+ int timeo;
- if ((time_second - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
+ np = VTONFS(vp);
+ vap = &np->n_vattr;
+ nmp = VFSTONFS(vp->v_mount);
+ /* XXX n_mtime doesn't seem to be updated on a miss-and-reload */
+ timeo = (time_second - np->n_mtime) / 10;
+
+#ifdef NFS_ACDEBUG
+ if (nfs_acdebug>1)
+ printf("nfs_getattrcache: initial timeo = %d\n", timeo);
+#endif
+
+ if (vap->va_type == VDIR) {
+ if ((np->n_flag & NMODIFIED) || timeo < nmp->nm_acdirmin)
+ timeo = nmp->nm_acdirmin;
+ else if (timeo > nmp->nm_acdirmax)
+ timeo = nmp->nm_acdirmax;
+ } else {
+ if ((np->n_flag & NMODIFIED) || timeo < nmp->nm_acregmin)
+ timeo = nmp->nm_acregmin;
+ else if (timeo > nmp->nm_acregmax)
+ timeo = nmp->nm_acregmax;
+ }
+
+#ifdef NFS_ACDEBUG
+ if (nfs_acdebug > 2)
+ printf("acregmin %d; acregmax %d; acdirmin %d; acdirmax %d\n",
+ nmp->nm_acregmin, nmp->nm_acregmax,
+ nmp->nm_acdirmin, nmp->nm_acdirmax);
+
+ if (nfs_acdebug)
+ printf("nfs_getattrcache: age = %d; final timeo = %d\n",r
+ (time_second - np->n_attrstamp), timeo);
+#endif
+
+ if ((time_second - np->n_attrstamp) >= timeo) {
nfsstats.attrcache_misses++;
return (ENOENT);
}
nfsstats.attrcache_hits++;
- vap = &np->n_vattr;
if (vap->va_size != np->n_size) {
if (vap->va_type == VREG) {
if (np->n_flag & NMODIFIED) {
diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c
index c2f9071..317b1c0 100644
--- a/sys/nfsserver/nfs_syscalls.c
+++ b/sys/nfsserver/nfs_syscalls.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
- * $Id: nfs_syscalls.c,v 1.36 1998/02/09 06:10:37 eivind Exp $
+ * $Id: nfs_syscalls.c,v 1.37 1998/03/30 09:54:17 phk Exp $
*/
#include <sys/param.h>
@@ -223,10 +223,10 @@ nfssvc(p, uap)
vput(nd.ni_vp);
if (error)
return (error);
- if ((nmp->nm_flag & NFSMNT_MNTD) &&
+ if ((nmp->nm_state & NFSSTA_MNTD) &&
(uap->flag & NFSSVC_GOTAUTH) == 0)
return (0);
- nmp->nm_flag |= NFSMNT_MNTD;
+ nmp->nm_state |= NFSSTA_MNTD;
error = nqnfs_clientd(nmp, p->p_ucred, &ncd, uap->flag,
uap->argp, p);
} else if (uap->flag & NFSSVC_ADDSOCK) {
@@ -514,10 +514,12 @@ nfssvc_nfsd(nsd, argp, p)
else if (slp->ns_flag & SLP_NEEDQ) {
slp->ns_flag &= ~SLP_NEEDQ;
(void) nfs_sndlock(&slp->ns_solock,
+ &slp->ns_solock,
(struct nfsreq *)0);
nfsrv_rcv(slp->ns_so, (caddr_t)slp,
M_WAIT);
- nfs_sndunlock(&slp->ns_solock);
+ nfs_sndunlock(&slp->ns_solock,
+ &slp->ns_solock);
}
error = nfsrv_dorec(slp, nfsd, &nd);
cur_usec = nfs_curusec();
@@ -677,7 +679,8 @@ nfssvc_nfsd(nsd, argp, p)
*mtod(m, u_long *) = htonl(0x80000000 | siz);
}
if (solockp)
- (void) nfs_sndlock(solockp, (struct nfsreq *)0);
+ (void) nfs_sndlock(solockp, solockp,
+ (struct nfsreq *)0);
if (slp->ns_flag & SLP_VALID)
error = nfs_send(so, nd->nd_nam2, m, NULL);
else {
@@ -693,7 +696,7 @@ nfssvc_nfsd(nsd, argp, p)
if (error == EPIPE)
nfsrv_zapsock(slp);
if (solockp)
- nfs_sndunlock(solockp);
+ nfs_sndunlock(solockp, solockp);
if (error == EINTR || error == ERESTART) {
free((caddr_t)nd, M_NFSRVDESC);
nfsrv_slpderef(slp);
@@ -899,17 +902,17 @@ nfs_getauth(nmp, rep, cred, auth_str, auth_len, verf_str, verf_len, key)
{
int error = 0;
- while ((nmp->nm_flag & NFSMNT_WAITAUTH) == 0) {
- nmp->nm_flag |= NFSMNT_WANTAUTH;
+ while ((nmp->nm_state & NFSSTA_WAITAUTH) == 0) {
+ nmp->nm_state |= NFSSTA_WANTAUTH;
(void) tsleep((caddr_t)&nmp->nm_authtype, PSOCK,
"nfsauth1", 2 * hz);
error = nfs_sigintr(nmp, rep, rep->r_procp);
if (error) {
- nmp->nm_flag &= ~NFSMNT_WANTAUTH;
+ nmp->nm_state &= ~NFSSTA_WANTAUTH;
return (error);
}
}
- nmp->nm_flag &= ~(NFSMNT_WAITAUTH | NFSMNT_WANTAUTH);
+ nmp->nm_state &= ~(NFSSTA_WAITAUTH | NFSSTA_WANTAUTH);
nmp->nm_authstr = *auth_str = (char *)malloc(RPCAUTH_MAXSIZ, M_TEMP, M_WAITOK);
nmp->nm_authlen = RPCAUTH_MAXSIZ;
nmp->nm_verfstr = verf_str;
@@ -920,13 +923,13 @@ nfs_getauth(nmp, rep, cred, auth_str, auth_len, verf_str, verf_len, key)
/*
* And wait for mount_nfs to do its stuff.
*/
- while ((nmp->nm_flag & NFSMNT_HASAUTH) == 0 && error == 0) {
+ while ((nmp->nm_state & NFSSTA_HASAUTH) == 0 && error == 0) {
(void) tsleep((caddr_t)&nmp->nm_authlen, PSOCK,
"nfsauth2", 2 * hz);
error = nfs_sigintr(nmp, rep, rep->r_procp);
}
- if (nmp->nm_flag & NFSMNT_AUTHERR) {
- nmp->nm_flag &= ~NFSMNT_AUTHERR;
+ if (nmp->nm_state & NFSSTA_AUTHERR) {
+ nmp->nm_state &= ~NFSSTA_AUTHERR;
error = EAUTH;
}
if (error)
@@ -936,10 +939,10 @@ nfs_getauth(nmp, rep, cred, auth_str, auth_len, verf_str, verf_len, key)
*verf_len = nmp->nm_verflen;
bcopy((caddr_t)nmp->nm_key, (caddr_t)key, sizeof (key));
}
- nmp->nm_flag &= ~NFSMNT_HASAUTH;
- nmp->nm_flag |= NFSMNT_WAITAUTH;
- if (nmp->nm_flag & NFSMNT_WANTAUTH) {
- nmp->nm_flag &= ~NFSMNT_WANTAUTH;
+ nmp->nm_state &= ~NFSSTA_HASAUTH;
+ nmp->nm_state |= NFSSTA_WAITAUTH;
+ if (nmp->nm_state & NFSSTA_WANTAUTH) {
+ nmp->nm_state &= ~NFSSTA_WANTAUTH;
wakeup((caddr_t)&nmp->nm_authtype);
}
return (error);
diff --git a/sys/nfsserver/nfsrvstats.h b/sys/nfsserver/nfsrvstats.h
index 8b28c00..ad606ad 100644
--- a/sys/nfsserver/nfsrvstats.h
+++ b/sys/nfsserver/nfsrvstats.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $Id: nfs.h,v 1.33 1998/02/01 21:23:29 bde Exp $
+ * $Id: nfs.h,v 1.34 1998/03/30 09:53:43 phk Exp $
*/
#ifndef _NFS_NFS_H_
@@ -56,11 +56,17 @@
#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
#define NFS_MAXGRPS 16 /* Max. size of groups list */
#ifndef NFS_MINATTRTIMO
-#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
+#define NFS_MINATTRTIMO 3 /* VREG attrib cache timeout in sec */
#endif
#ifndef NFS_MAXATTRTIMO
#define NFS_MAXATTRTIMO 60
#endif
+#ifndef NFS_MINDIRATTRTIMO
+#define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */
+#endif
+#ifndef NFS_MAXDIRATTRTIMO
+#define NFS_MAXDIRATTRTIMO 60
+#endif
#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
#define NFS_READDIRSIZE 8192 /* Def. readdir size */
@@ -104,15 +110,6 @@
#endif
/*
- * Set the attribute timeout based on how recently the file has been modified.
- */
-#define NFS_ATTRTIMEO(np) \
- ((((np)->n_flag & NMODIFIED) || \
- (time_second - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
- ((time_second - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
- (time_second - (np)->n_mtime) / 10))
-
-/*
* Expected allocation sizes for major data structures. If the actual size
* of the structure exceeds these sizes, then malloc() will be allocating
* almost twice the memory required. This is used in nfs_init() to warn
@@ -149,6 +146,10 @@ struct nfs_args {
int leaseterm; /* Term (sec) of lease */
int deadthresh; /* Retrans threshold */
char *hostname; /* server's name */
+ int acregmin; /* cache attrs for reg files min time */
+ int acregmax; /* cache attrs for reg files max time */
+ int acdirmin; /* cache attrs for dirs min time */
+ int acdirmax; /* cache attrs for dirs max time */
};
/*
@@ -172,21 +173,25 @@ struct nfs_args {
#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
-#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */
-#define NFSMNT_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
-#define NFSMNT_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */
-#define NFSMNT_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
-#define NFSMNT_MNTD 0x00200000 /* Mnt server for mnt point */
-#define NFSMNT_DISMINPROG 0x00400000 /* Dismount in progress */
-#define NFSMNT_DISMNT 0x00800000 /* Dismounted */
-#define NFSMNT_SNDLOCK 0x01000000 /* Send socket lock */
-#define NFSMNT_WANTSND 0x02000000 /* Want above */
-#define NFSMNT_RCVLOCK 0x04000000 /* Rcv socket lock */
-#define NFSMNT_WANTRCV 0x08000000 /* Want above */
-#define NFSMNT_WAITAUTH 0x10000000 /* Wait for authentication */
-#define NFSMNT_HASAUTH 0x20000000 /* Has authenticator */
-#define NFSMNT_WANTAUTH 0x40000000 /* Wants an authenticator */
-#define NFSMNT_AUTHERR 0x80000000 /* Authentication error */
+#define NFSMNT_ACREGMIN 0x00040000
+#define NFSMNT_ACREGMAX 0x00080000
+#define NFSMNT_ACDIRMIN 0x00100000
+#define NFSMNT_ACDIRMAX 0x00200000
+
+#define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
+#define NFSSTA_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */
+#define NFSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
+#define NFSSTA_MNTD 0x00200000 /* Mnt server for mnt point */
+#define NFSSTA_DISMINPROG 0x00400000 /* Dismount in progress */
+#define NFSSTA_DISMNT 0x00800000 /* Dismounted */
+#define NFSSTA_SNDLOCK 0x01000000 /* Send socket lock */
+#define NFSSTA_WANTSND 0x02000000 /* Want above */
+#define NFSSTA_RCVLOCK 0x04000000 /* Rcv socket lock */
+#define NFSSTA_WANTRCV 0x08000000 /* Want above */
+#define NFSSTA_WAITAUTH 0x10000000 /* Wait for authentication */
+#define NFSSTA_HASAUTH 0x20000000 /* Has authenticator */
+#define NFSSTA_WANTAUTH 0x40000000 /* Wants an authenticator */
+#define NFSSTA_AUTHERR 0x80000000 /* Authentication error */
/*
* Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
@@ -580,8 +585,8 @@ int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
int, int, u_quad_t *, struct mbuf **, struct mbuf **,
caddr_t *));
-int nfs_sndlock __P((int *, struct nfsreq *));
-void nfs_sndunlock __P((int *flagp));
+int nfs_sndlock __P((int *, int *, struct nfsreq *));
+void nfs_sndunlock __P((int *, int *));
int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
int));
OpenPOWER on IntegriCloud