Extend NFS_V2_ONLY to remove NQNFS lease support as well. Saves another 10k.

This commit is contained in:
bjh21 2000-09-19 23:26:25 +00:00
parent 082a77ccfe
commit 1f4240a461
6 changed files with 45 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_time.c,v 1.53 2000/08/02 12:24:11 itojun Exp $ */
/* $NetBSD: kern_time.c,v 1.54 2000/09/19 23:26:25 bjh21 Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -72,6 +72,7 @@
*/
#include "fs_nfs.h"
#include "opt_nfs.h"
#include "opt_nfsserver.h"
#include <sys/param.h>
@ -136,7 +137,7 @@ settime(tv)
ci = curcpu();
timeradd(&ci->ci_schedstate.spc_runtime, &delta,
&ci->ci_schedstate.spc_runtime);
# if defined(NFS) || defined(NFSSERVER)
# if (defined(NFS) && !defined (NFS_V2_ONLY)) || defined(NFSSERVER)
nqnfs_lease_updatetime(delta.tv_sec);
# endif
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_bio.c,v 1.52 2000/09/19 22:11:47 fvdl Exp $ */
/* $NetBSD: nfs_bio.c,v 1.53 2000/09/19 23:26:26 bjh21 Exp $ */
/*
* Copyright (c) 1989, 1993
@ -160,6 +160,7 @@ nfs_bioread(vp, uio, ioflag, cred, cflag)
}
do {
#ifndef NFS_V2_ONLY
/*
* Get a valid lease. If cached data is stale, flush it.
*/
@ -190,6 +191,7 @@ nfs_bioread(vp, uio, ioflag, cred, cflag)
return (error);
}
}
#endif
/*
* Don't cache symlinks.
*/
@ -625,6 +627,7 @@ nfs_write(v)
*/
(void)uvm_vnp_uncache(vp);
#ifndef NFS_V2_ONLY
/*
* Check for a valid write lease.
*/
@ -643,6 +646,7 @@ nfs_write(v)
np->n_brev = np->n_lrev;
}
}
#endif
if ((np->n_flag & NQNFSNONCACHE) && uio->uio_iovcnt == 1) {
iomode = NFSV3WRITE_FILESYNC;
error = nfs_writerpc(vp, uio, cred, &iomode, &must_commit);
@ -682,6 +686,7 @@ again:
goto again;
}
#ifndef NFS_V2_ONLY
/*
* Check for valid write lease and get one as required.
* In case getblk() and/or bwrite() delayed us.
@ -705,6 +710,7 @@ again:
goto again;
}
}
#endif
error = uiomove((char *)bp->b_data + on, n, uio);
if (error) {
bp->b_flags |= B_ERROR;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_nqlease.c,v 1.33 2000/09/19 22:05:29 fvdl Exp $ */
/* $NetBSD: nfs_nqlease.c,v 1.34 2000/09/19 23:26:26 bjh21 Exp $ */
/*
* Copyright (c) 1992, 1993
@ -53,6 +53,7 @@
*/
#include "fs_nfs.h"
#include "opt_nfs.h"
#include "opt_nfsserver.h"
#include "opt_inet.h"
@ -134,6 +135,7 @@ extern struct nfsstats nfsstats;
#define TRUE 1
#define FALSE 0
#if defined(NFSSERVER) || (defined(NFS) && !defined(NFS_V2_ONLY))
/*
* Get or check for a lease for "vp", based on ND_CHECK flag.
* The rules are as follows:
@ -592,6 +594,7 @@ tryagain:
lph++;
}
}
#endif /* NFSSERVER || (NFS && !NFS_V2_ONLY) */
#ifdef NFSSERVER
/*
@ -819,7 +822,7 @@ nfsmout:
}
#endif /* NFSSERVER */
#ifdef NFS
#if defined(NFS) && !defined(NFS_V2_ONLY)
/*
* Client get lease rpc function.
*/
@ -971,7 +974,9 @@ nqnfs_callback(nmp, mrep, md, dpos)
vrele(vp);
nfsm_srvdone;
}
#endif /* NFS && !NFS_V2_ONLY */
#ifdef NFS /* Needed in V2_ONLY case for Kerberos stuff */
/*
* Nqnfs client helper daemon. Runs once a second to expire leases.
* It also get authorization strings for "kerb" mounts.
@ -988,11 +993,14 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
caddr_t argp;
struct proc *p;
{
#ifndef NFS_V2_ONLY
struct nfsnode *np;
struct vnode *vp;
struct nfsreq myrep;
int vpid;
#endif
int error = 0, sleepreturn;
struct nfsuid *nuidp, *nnuidp;
int error = 0, vpid, sleepreturn;
/*
* First initialize some variables
@ -1037,6 +1045,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
sleepreturn = 0;
continue;
}
#ifndef NFS_V2_ONLY
if (nmp->nm_flag & NFSMNT_NQNFS) {
/*
* If there are no outstanding requests (and therefore no
@ -1103,6 +1112,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
np = nmp->nm_timerhead.cqh_first;
}
}
#endif /* !NFS_V2_ONLY */
/*
* Get an authorization string, if required.
@ -1139,7 +1149,9 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
error = 0;
return (error);
}
#endif /* NFS */
#if defined(NFS) && !defined(NFS_V2_ONLY)
/*
* Update a client lease.
*/
@ -1176,8 +1188,9 @@ nqnfs_clientlease(nmp, np, rwflag, cachable, expiry, frev)
CIRCLEQ_INSERT_AFTER(&nmp->nm_timerhead, tp, np, n_timer);
}
}
#endif /* NFS */
#endif /* NFS && !NFS_V2_ONLY */
#if defined(NFSSERVER) || (defined(NFS) && !defined(NFS_V2_ONLY))
/*
* Adjust all timer queue expiry times when the time of day clock is changed.
* Called from the settimeofday() syscall.
@ -1257,3 +1270,4 @@ nqsrv_unlocklease(lp)
if (lp->lc_flag & LC_WANTED)
wakeup((caddr_t)lp);
}
#endif /* NFSSERVER || NFS && !NFS_V2_ONLY */

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_socket.c,v 1.60 2000/09/19 22:21:21 fvdl Exp $ */
/* $NetBSD: nfs_socket.c,v 1.61 2000/09/19 23:26:26 bjh21 Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@ -773,10 +773,13 @@ nfs_reply(myrep)
nfsm_dissect(tl, u_int32_t *, 2*NFSX_UNSIGNED);
rxid = *tl++;
if (*tl != rpc_reply) {
#ifndef NFS_V2_ONLY
if (nmp->nm_flag & NFSMNT_NQNFS) {
if (nqnfs_callback(nmp, mrep, md, dpos))
nfsstats.rpcinvalid++;
} else {
} else
#endif
{
nfsstats.rpcinvalid++;
m_freem(mrep);
}
@ -1127,6 +1130,7 @@ tryagain:
return (error);
}
#ifndef NFS_V2_ONLY
/*
* For nqnfs, get any lease in reply
*/
@ -1145,6 +1149,7 @@ tryagain:
}
}
}
#endif
*mrp = mrep;
*mdp = md;
*dposp = dpos;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_subs.c,v 1.83 2000/09/19 22:13:55 fvdl Exp $ */
/* $NetBSD: nfs_subs.c,v 1.84 2000/09/19 23:26:26 bjh21 Exp $ */
/*
* Copyright (c) 1989, 1993
@ -608,6 +608,7 @@ nfsm_reqh(vp, procid, hsiz, bposp)
*/
if (vp) {
nmp = VFSTONFS(vp->v_mount);
#ifndef NFS_V2_ONLY
if (nmp->nm_flag & NFSMNT_NQNFS) {
nqflag = NQNFS_NEEDLEASE(vp, procid);
if (nqflag) {
@ -619,6 +620,7 @@ nfsm_reqh(vp, procid, hsiz, bposp)
*tl = 0;
}
}
#endif
}
/* Finally, return values */
*bposp = bpos;
@ -1453,6 +1455,7 @@ nfs_init()
nfsrv_initcache(); /* Init the server request cache */
#endif /* NFSSERVER */
#if defined(NFSSERVER) || !defined(NFS_V2_ONLY)
/*
* Initialize the nqnfs data structures.
*/
@ -1463,6 +1466,7 @@ nfs_init()
CIRCLEQ_INIT(&nqtimerhead);
nqfhhashtbl = hashinit(NQLCHSZ, M_NQLEASE, M_WAITOK, &nqfhhash);
}
#endif
/*
* Initialize reply list and start timer

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vnops.c,v 1.120 2000/09/19 22:18:03 fvdl Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.121 2000/09/19 23:26:26 bjh21 Exp $ */
/*
* Copyright (c) 1989, 1993
@ -437,6 +437,7 @@ nfs_open(v)
#endif
return (EACCES);
}
#ifndef NFS_V2_ONLY
/*
* Get a valid lease. If cached data is stale, flush it.
*/
@ -457,7 +458,9 @@ nfs_open(v)
np->n_brev = np->n_lrev;
}
}
} else {
} else
#endif
{
if (np->n_flag & NMODIFIED) {
if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
ap->a_p, 1)) == EINTR)