summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-06-25 03:28:17 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-06-25 03:28:17 +0000
commit02698d2f8cd41e95a05746c99ee27bcc29a1549d (patch)
tree6ff1e61ba9a420b787527749c074929ad022fa76 /sys
parenteebaafe0f06c811aadafe68ad8a541c33236040c (diff)
Remove NQNFS
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/files3
-rw-r--r--sys/kern/kern_time.c5
-rw-r--r--sys/kern/vfs_default.c10
-rw-r--r--sys/nfs/nfs.h4
-rw-r--r--sys/nfs/nfs_bio.c97
-rw-r--r--sys/nfs/nfs_node.c14
-rw-r--r--sys/nfs/nfs_nqlease.c1241
-rw-r--r--sys/nfs/nfs_serv.c29
-rw-r--r--sys/nfs/nfs_socket.c110
-rw-r--r--sys/nfs/nfs_srvcache.c3
-rw-r--r--sys/nfs/nfs_subs.c58
-rw-r--r--sys/nfs/nfs_syscalls.c132
-rw-r--r--sys/nfs/nfs_var.h31
-rw-r--r--sys/nfs/nfs_vfsops.c30
-rw-r--r--sys/nfs/nfs_vnops.c94
-rw-r--r--sys/nfs/nfsmount.h3
-rw-r--r--sys/nfs/nfsnode.h5
-rw-r--r--sys/nfs/nfsproto.h7
-rw-r--r--sys/nfs/nfsrtt.h3
-rw-r--r--sys/nfs/nfsrvcache.h3
-rw-r--r--sys/nfs/nqnfs.h216
21 files changed, 189 insertions, 1909 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 01830a8b22a..0af2a2d4dc3 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.206 2001/06/24 19:48:57 kjell Exp $
+# $OpenBSD: files,v 1.207 2001/06/25 03:28:01 csapuntz Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -698,7 +698,6 @@ file nfs/krpc_subr.c nfsclient
file nfs/nfs_bio.c nfsclient
file nfs/nfs_boot.c nfsclient
file nfs/nfs_node.c nfsclient
-file nfs/nfs_nqlease.c nfsserver | nfsclient
file nfs/nfs_serv.c nfsserver
file nfs/nfs_socket.c nfsserver | nfsclient
file nfs/nfs_srvcache.c nfsserver
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 955c7b5ffa6..60bbbcdae70 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_time.c,v 1.23 2000/10/10 13:36:49 itojun Exp $ */
+/* $OpenBSD: kern_time.c,v 1.24 2001/06/25 03:28:03 csapuntz Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
@@ -82,9 +82,6 @@ settime(tv)
(void) spllowersoftclock();
timeradd(&boottime, &delta, &boottime);
timeradd(&runtime, &delta, &runtime);
-# if defined(NFS) || defined(NFSSERVER)
- nqnfs_lease_updatetime(delta.tv_sec);
-# endif
splx(s);
resettodr();
}
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index c00deeb9d14..8f426b3a3f5 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_default.c,v 1.6 2001/06/22 14:14:10 deraadt Exp $ */
+/* $OpenBSD: vfs_default.c,v 1.7 2001/06/25 03:28:03 csapuntz Exp $ */
/*
@@ -302,3 +302,11 @@ filt_generic_readwrite(struct knote *kn, long hint)
kn->kn_data = 0;
return (1);
}
+
+int lease_check(void *);
+
+int
+lease_check(void *v)
+{
+ return (0);
+}
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index 7d794cf0ba6..e1574056d34 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.h,v 1.10 2000/05/22 17:33:18 mickey Exp $ */
+/* $OpenBSD: nfs.h,v 1.11 2001/06/25 03:28:05 csapuntz Exp $ */
/* $NetBSD: nfs.h,v 1.10.4.1 1996/05/27 11:23:56 fvdl Exp $ */
/*
@@ -438,7 +438,6 @@ struct nfsrv_descript {
int nd_len; /* Length of this write */
int nd_repstat; /* Reply status */
u_int32_t nd_retxid; /* Reply xid */
- u_int32_t nd_duration; /* Lease duration */
struct timeval nd_starttime; /* Time RPC initiated */
fhandle_t nd_fh; /* File handle */
struct ucred nd_cr; /* Credentials */
@@ -450,7 +449,6 @@ struct nfsrv_descript {
#define ND_CHECK 0x04
#define ND_LEASE (ND_READ | ND_WRITE | ND_CHECK)
#define ND_NFSV3 0x08
-#define ND_NQNFS 0x10
#define ND_KERBNICK 0x20
#define ND_KERBFULL 0x40
#define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL)
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index 9ffdac49d79..dd368e9c2af 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.19 2001/06/25 02:15:46 csapuntz Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.20 2001/06/25 03:28:06 csapuntz Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */
/*
@@ -57,13 +57,12 @@
#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
#include <nfs/nfsmount.h>
-#include <nfs/nqnfs.h>
#include <nfs/nfsnode.h>
#include <nfs/nfs_var.h>
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
extern int nfs_numasync;
-extern struct nfsstats nfsstats;
+struct nfsstats nfsstats;
/*
* Vnode op for read using bio
@@ -102,7 +101,6 @@ nfs_bioread(vp, uio, ioflag, cred)
* For nfs, cache consistency can only be maintained approximately.
* Although RFC1094 does not specify the criteria, the following is
* believed to be compatible with the reference port.
- * For nqnfs, full cache consistency is maintained within the loop.
* For nfs:
* If the file's modify time on the server has changed since the
* last read rpc or you have written to the file,
@@ -115,7 +113,7 @@ nfs_bioread(vp, uio, ioflag, cred)
* attributes this could be forced by setting n_attrstamp to 0 before
* the VOP_GETATTR() call.
*/
- if ((nmp->nm_flag & NFSMNT_NQNFS) == 0 && vp->v_type != VLNK) {
+ if (vp->v_type != VLNK) {
if (np->n_flag & NMODIFIED) {
np->n_attrstamp = 0;
error = VOP_GETATTR(vp, &vattr, cred, p);
@@ -135,31 +133,10 @@ nfs_bioread(vp, uio, ioflag, cred)
}
}
do {
-
- /*
- * Get a valid lease. If cached data is stale, flush it.
- */
- if (nmp->nm_flag & NFSMNT_NQNFS) {
- if (NQNFS_CKINVALID(vp, np, ND_READ)) {
- do {
- error = nqnfs_getlease(vp, ND_READ, cred, p);
- } while (error == NQNFS_EXPIRED);
- if (error)
- return (error);
- if (np->n_lrev != np->n_brev ||
- (np->n_flag & NQNFSNONCACHE)) {
- error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
- if (error)
- return (error);
- np->n_brev = np->n_lrev;
- }
- }
- }
/*
* Don't cache symlinks.
*/
- if (np->n_flag & NQNFSNONCACHE
- || ((vp->v_flag & VROOT) && vp->v_type == VLNK)) {
+ if ((vp->v_flag & VROOT) && vp->v_type == VLNK) {
switch (vp->v_type) {
case VREG:
return (nfs_readrpc(vp, uio, cred));
@@ -321,7 +298,7 @@ nfs_write(v)
struct vattr vattr;
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
daddr_t lbn, bn;
- int n, on, error = 0, iomode, must_commit;
+ int n, on, error = 0;
#ifdef DIAGNOSTIC
if (uio->uio_rw != UIO_WRITE)
@@ -382,31 +359,6 @@ nfs_write(v)
(void)vnode_pager_uncache(vp);
#endif
- /*
- * Check for a valid write lease.
- */
- if ((nmp->nm_flag & NFSMNT_NQNFS) &&
- NQNFS_CKINVALID(vp, np, ND_WRITE)) {
- do {
- error = nqnfs_getlease(vp, ND_WRITE, cred, p);
- } while (error == NQNFS_EXPIRED);
- if (error)
- return (error);
- if (np->n_lrev != np->n_brev ||
- (np->n_flag & NQNFSNONCACHE)) {
- error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
- if (error)
- return (error);
- np->n_brev = np->n_lrev;
- }
- }
- if ((np->n_flag & NQNFSNONCACHE) && uio->uio_iovcnt == 1) {
- iomode = NFSV3WRITE_FILESYNC;
- error = nfs_writerpc(vp, uio, cred, &iomode, &must_commit);
- if (must_commit)
- nfs_clearcommit(vp->v_mount);
- return (error);
- }
nfsstats.biocache_writes++;
lbn = uio->uio_offset / biosize;
on = uio->uio_offset & (biosize-1);
@@ -443,29 +395,6 @@ again:
goto again;
}
- /*
- * Check for valid write lease and get one as required.
- * In case getblk() and/or bwrite() delayed us.
- */
- if ((nmp->nm_flag & NFSMNT_NQNFS) &&
- NQNFS_CKINVALID(vp, np, ND_WRITE)) {
- do {
- error = nqnfs_getlease(vp, ND_WRITE, cred, p);
- } while (error == NQNFS_EXPIRED);
- if (error) {
- brelse(bp);
- return (error);
- }
- if (np->n_lrev != np->n_brev ||
- (np->n_flag & NQNFSNONCACHE)) {
- brelse(bp);
- error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
- if (error)
- return (error);
- np->n_brev = np->n_lrev;
- goto again;
- }
- }
error = uiomove((char *)bp->b_data + on, n, uio);
if (error) {
bp->b_flags |= B_ERROR;
@@ -497,18 +426,12 @@ again:
/*
* If the lease is non-cachable or IO_SYNC do bwrite().
*/
- if ((np->n_flag & NQNFSNONCACHE) || (ioflag & IO_SYNC)) {
+ if (ioflag & IO_SYNC) {
bp->b_proc = p;
error = VOP_BWRITE(bp);
if (error)
return (error);
- if (np->n_flag & NQNFSNONCACHE) {
- error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
- if (error)
- return (error);
- }
- } else if ((n + on) == biosize &&
- (nmp->nm_flag & NFSMNT_NQNFS) == 0) {
+ } else if ((n + on) == biosize) {
bp->b_proc = (struct proc *)0;
bp->b_flags |= B_ASYNC;
(void)nfs_writebp(bp, 0);
@@ -747,11 +670,7 @@ nfs_doio(bp, cr, p)
bp->b_validend = bp->b_bcount;
}
if (p && (vp->v_flag & VTEXT) &&
- (((nmp->nm_flag & NFSMNT_NQNFS) &&
- NQNFS_CKINVALID(vp, np, ND_READ) &&
- np->n_lrev != np->n_brev) ||
- (!(nmp->nm_flag & NFSMNT_NQNFS) &&
- np->n_mtime != np->n_vattr.va_mtime.tv_sec))) {
+ (np->n_mtime != np->n_vattr.va_mtime.tv_sec)) {
uprintf("Process killed due to text file modification\n");
psignal(p, SIGKILL);
p->p_holdcnt++;
diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c
index f3d08f5a101..f23e8087a8f 100644
--- a/sys/nfs/nfs_node.c
+++ b/sys/nfs/nfs_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_node.c,v 1.14 2001/06/24 21:16:19 csapuntz Exp $ */
+/* $OpenBSD: nfs_node.c,v 1.15 2001/06/25 03:28:06 csapuntz Exp $ */
/* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */
/*
@@ -54,7 +54,6 @@
#include <nfs/nfs.h>
#include <nfs/nfsnode.h>
#include <nfs/nfsmount.h>
-#include <nfs/nqnfs.h>
#include <nfs/nfs_var.h>
LIST_HEAD(nfsnodehashhead, nfsnode) *nfsnodehashtbl;
@@ -207,8 +206,7 @@ nfs_inactive(v)
vrele(sp->s_dvp);
FREE((caddr_t)sp, M_NFSREQ);
}
- np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NQNFSEVICTED |
- NQNFSNONCACHE | NQNFSWRITE);
+ np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT);
VOP_UNLOCK(ap->a_vp, 0, ap->a_p);
return (0);
@@ -226,7 +224,6 @@ nfs_reclaim(v)
} */ *ap = v;
register struct vnode *vp = ap->a_vp;
register struct nfsnode *np = VTONFS(vp);
- register struct nfsmount *nmp = VFSTONFS(vp->v_mount);
register struct nfsdmap *dp, *dp2;
extern int prtactive;
@@ -237,13 +234,6 @@ nfs_reclaim(v)
LIST_REMOVE(np, n_hash);
/*
- * For nqnfs, take it off the timer queue as required.
- */
- if ((nmp->nm_flag & NFSMNT_NQNFS) && np->n_timer.cqe_next != 0) {
- CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
- }
-
- /*
* Free up any directory cookie structures and
* large file handle structures that might be associated with
* this nfs node.
diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c
deleted file mode 100644
index fca4f72a782..00000000000
--- a/sys/nfs/nfs_nqlease.c
+++ /dev/null
@@ -1,1241 +0,0 @@
-/* $OpenBSD: nfs_nqlease.c,v 1.16 2001/06/25 02:15:46 csapuntz Exp $ */
-/* $NetBSD: nfs_nqlease.c,v 1.14 1996/02/18 14:06:50 fvdl Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Rick Macklem at The University of Guelph.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95
- */
-
-/*
- * References:
- * Cary G. Gray and David R. Cheriton, "Leases: An Efficient Fault-Tolerant
- * Mechanism for Distributed File Cache Consistency",
- * In Proc. of the Twelfth ACM Symposium on Operating Systems
- * Principals, pg. 202-210, Litchfield Park, AZ, Dec. 1989.
- * Michael N. Nelson, Brent B. Welch and John K. Ousterhout, "Caching
- * in the Sprite Network File System", ACM TOCS 6(1),
- * pages 134-154, February 1988.
- * V. Srinivasan and Jeffrey C. Mogul, "Spritely NFS: Implementation and
- * Performance of Cache-Consistency Protocols", Digital
- * Equipment Corporation WRL Research Report 89/5, May 1989.
- */
-#include <sys/param.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/file.h>
-#include <sys/buf.h>
-#include <sys/stat.h>
-#include <sys/protosw.h>
-#include <sys/namei.h>
-
-#include <netinet/in.h>
-#include <nfs/rpcv2.h>
-#include <nfs/nfsproto.h>
-#include <nfs/nfs.h>
-#include <nfs/nfsm_subs.h>
-#include <nfs/xdr_subs.h>
-#include <nfs/nqnfs.h>
-#include <nfs/nfsnode.h>
-#include <nfs/nfsmount.h>
-#include <nfs/nfs_var.h>
-
-time_t nqnfsstarttime = (time_t)0;
-int nqsrv_clockskew = NQ_CLOCKSKEW;
-int nqsrv_writeslack = NQ_WRITESLACK;
-int nqsrv_maxlease = NQ_MAXLEASE;
-int nqsrv_maxnumlease = NQ_MAXNUMLEASE;
-
-/*
- * Signifies which rpcs can have piggybacked lease requests
- */
-int nqnfs_piggy[NFS_NPROCS] = {
- 0,
- 0,
- ND_WRITE,
- ND_READ,
- 0,
- ND_READ,
- ND_READ,
- ND_WRITE,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- ND_READ,
- ND_READ,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-extern nfstype nfsv2_type[9];
-extern nfstype nfsv3_type[9];
-extern struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
-extern int nfsd_waiting;
-struct nfsstats nfsstats;
-
-
-#define TRUE 1
-#define FALSE 0
-
-/*
- * Get or check for a lease for "vp", based on ND_CHECK flag.
- * The rules are as follows:
- * - if a current non-caching lease, reply non-caching
- * - if a current lease for same host only, extend lease
- * - if a read cachable lease and a read lease request
- * add host to list any reply cachable
- * - else { set non-cachable for read-write sharing }
- * send eviction notice messages to all other hosts that have lease
- * wait for lease termination { either by receiving vacated messages
- * from all the other hosts or expiry
- * via. timeout }
- * modify lease to non-cachable
- * - else if no current lease, issue new one
- * - reply
- * - return boolean TRUE iff nam should be m_freem()'d
- * NB: Since nqnfs_serverd() is called from a timer, any potential tsleep()
- * in here must be framed by nqsrv_locklease() and nqsrv_unlocklease().
- * nqsrv_locklease() is coded such that at least one of LC_LOCKED and
- * LC_WANTED is set whenever a process is tsleeping in it. The exception
- * is when a new lease is being allocated, since it is not in the timer
- * queue yet. (Ditto for the splsoftclock() and splx(s) calls)
- */
-int
-nqsrv_getlease(vp, duration, flags, slp, procp, nam, cachablep, frev, cred)
- struct vnode *vp;
- u_int32_t *duration;
- int flags;
- struct nfssvc_sock *slp;
- struct proc *procp;
- struct mbuf *nam;
- int *cachablep;
- u_quad_t *frev;
- struct ucred *cred;
-{
- register struct nqlease *lp;
- register struct nqfhhashhead *lpp = NULL;
- register struct nqhost *lph = NULL;
- struct nqlease *tlp;
- struct nqm **lphp;
- struct vattr vattr;
- fhandle_t fh;
- int i, ok, error, s;
-
- if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK)
- return (0);
- if (*duration > nqsrv_maxlease)
- *duration = nqsrv_maxlease;
- error = VOP_GETATTR(vp, &vattr, cred, procp);
- if (error)
- return (error);
- *frev = vattr.va_filerev;
- s = splsoftclock();
- tlp = 0;
- if ((flags & ND_CHECK) == 0)
- nfsstats.srvnqnfs_getleases++;
- if (tlp == 0) {
- /*
- * Find the lease by searching the hash list.
- */
- fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
- error = VFS_VPTOFH(vp, &fh.fh_fid);
- if (error) {
- splx(s);
- return (error);
- }
- lpp = NQFHHASH(fh.fh_fid.fid_data);
- for (lp = lpp->lh_first; lp != 0; lp = lp->lc_hash.le_next)
- if (fh.fh_fsid.val[0] == lp->lc_fsid.val[0] &&
- fh.fh_fsid.val[1] == lp->lc_fsid.val[1] &&
- !bcmp(fh.fh_fid.fid_data, lp->lc_fiddata,
- fh.fh_fid.fid_len - sizeof (int32_t))) {
- /* Found it */
- lp->lc_vp = vp;
- tlp = lp;
- break;
- }
- } else
- lp = tlp;
- if (lp != 0) {
- if ((lp->lc_flag & LC_NONCACHABLE) ||
- (lp->lc_morehosts == (struct nqm *)0 &&
- nqsrv_cmpnam(slp, nam, &lp->lc_host)))
- goto doreply;
- if ((flags & ND_READ) && (lp->lc_flag & LC_WRITE) == 0) {
- if (flags & ND_CHECK)
- goto doreply;
- if (nqsrv_cmpnam(slp, nam, &lp->lc_host))
- goto doreply;
- i = 0;
- if (lp->lc_morehosts) {
- lph = lp->lc_morehosts->lpm_hosts;
- lphp = &lp->lc_morehosts->lpm_next;
- ok = 1;
- } else {
- lphp = &lp->lc_morehosts;
- ok = 0;
- }
- while (ok && (lph->lph_flag & LC_VALID)) {
- if (nqsrv_cmpnam(slp, nam, lph))
- goto doreply;
- if (++i == LC_MOREHOSTSIZ) {
- i = 0;
- if (*lphp) {
- lph = (*lphp)->lpm_hosts;
- lphp = &((*lphp)->lpm_next);
- } else
- ok = 0;
- } else
- lph++;
- }
- nqsrv_locklease(lp);
- if (!ok) {
- *lphp = (struct nqm *)
- malloc(sizeof (struct nqm),
- M_NQMHOST, M_WAITOK);
- bzero((caddr_t)*lphp, sizeof (struct nqm));
- lph = (*lphp)->lpm_hosts;
- }
- nqsrv_addhost(lph, slp, nam);
- nqsrv_unlocklease(lp);
- } else {
- lp->lc_flag |= LC_NONCACHABLE;
- nqsrv_locklease(lp);
- nqsrv_send_eviction(vp, lp, slp, nam, cred);
- nqsrv_waitfor_expiry(lp);
- nqsrv_unlocklease(lp);
- }
-doreply:
- /*
- * Update the lease and return
- */
- if ((flags & ND_CHECK) == 0)
- nqsrv_instimeq(lp, *duration);
- if (lp->lc_flag & LC_NONCACHABLE)
- *cachablep = 0;
- else {
- *cachablep = 1;
- if (flags & ND_WRITE)
- lp->lc_flag |= LC_WRITTEN;
- }
- splx(s);
- return (0);
- }
- splx(s);
- if (flags & ND_CHECK)
- return (0);
-
- /*
- * Allocate new lease
- * The value of nqsrv_maxnumlease should be set generously, so that
- * the following "printf" happens infrequently.
- */
- if (nfsstats.srvnqnfs_leases > nqsrv_maxnumlease) {
- printf("Nqnfs server, too many leases\n");
- do {
- (void) tsleep((caddr_t)&lbolt, PSOCK,
- "nqsrvnuml", 0);
- } while (nfsstats.srvnqnfs_leases > nqsrv_maxnumlease);
- }
- MALLOC(lp, struct nqlease *, sizeof (struct nqlease), M_NQLEASE, M_WAITOK);
- bzero((caddr_t)lp, sizeof (struct nqlease));
- if (flags & ND_WRITE)
- lp->lc_flag |= (LC_WRITE | LC_WRITTEN);
- nqsrv_addhost(&lp->lc_host, slp, nam);
- lp->lc_vp = vp;
- lp->lc_fsid = fh.fh_fsid;
- bcopy(fh.fh_fid.fid_data, lp->lc_fiddata,
- fh.fh_fid.fid_len - sizeof (int32_t));
- if(!lpp)
- panic("nfs_nqlease.c: Phoney lpp");
- LIST_INSERT_HEAD(lpp, lp, lc_hash);
- s = splsoftclock();
- nqsrv_instimeq(lp, *duration);
- splx(s);
- *cachablep = 1;
- if (++nfsstats.srvnqnfs_leases > nfsstats.srvnqnfs_maxleases)
- nfsstats.srvnqnfs_maxleases = nfsstats.srvnqnfs_leases;
- return (0);
-}
-
-/*
- * Local lease check for server syscalls.
- * Just set up args and let nqsrv_getlease() do the rest.
- */
-int
-nqnfs_vop_lease_check(v)
- void *v;
-{
- struct vop_lease_args /* {
- struct vnode *a_vp;
- struct proc *a_p;
- struct ucred *a_cred;
- int a_flag;
- } */ *ap = v;
- u_int32_t duration = 0;
- int cache;
- u_quad_t frev;
-
- (void) nqsrv_getlease(ap->a_vp, &duration, ND_CHECK | ap->a_flag,
- NQLOCALSLP, ap->a_p, (struct mbuf *)0, &cache, &frev, ap->a_cred);
- return (0);
-}
-
-/*
- * Add a host to an nqhost structure for a lease.
- */
-void
-nqsrv_addhost(lph, slp, nam)
- register struct nqhost *lph;
- struct nfssvc_sock *slp;
- struct mbuf *nam;
-{
- register struct sockaddr_in *saddr;
-
- if (slp == NQLOCALSLP)
- lph->lph_flag |= (LC_VALID | LC_LOCAL);
- else if (slp == nfs_udpsock) {
- saddr = mtod(nam, struct sockaddr_in *);
- lph->lph_flag |= (LC_VALID | LC_UDP);
- lph->lph_inetaddr = saddr->sin_addr.s_addr;
- lph->lph_port = saddr->sin_port;
- } else if (slp == nfs_cltpsock) {
- lph->lph_nam = m_copym(nam, 0, M_COPYALL, M_WAIT);
- lph->lph_flag |= (LC_VALID | LC_CLTP);
- } else {
- lph->lph_flag |= (LC_VALID | LC_SREF);
- lph->lph_slp = slp;
- slp->ns_sref++;
- }
-}
-
-/*
- * Update the lease expiry time and position it in the timer queue correctly.
- */
-void
-nqsrv_instimeq(lp, duration)
- register struct nqlease *lp;
- u_int32_t duration;
-{
- register struct nqlease *tlp;
- time_t newexpiry;
-
- newexpiry = time.tv_sec + duration + nqsrv_clockskew;
- if (lp->lc_expiry == newexpiry)
- return;
- if (lp->lc_timer.cqe_next != 0)
- CIRCLEQ_REMOVE(&nqtimerhead, lp, lc_timer);
- lp->lc_expiry = newexpiry;
-
- /*
- * Find where in the queue it should be.
- */
- tlp = nqtimerhead.cqh_last;
- while (tlp != (void *)&nqtimerhead && tlp->lc_expiry > newexpiry)
- tlp = tlp->lc_timer.cqe_prev;
-#ifdef HASNVRAM
- if (tlp == nqtimerhead.cqh_last)
- NQSTORENOVRAM(newexpiry);
-#endif /* HASNVRAM */
- if (tlp == (void *)&nqtimerhead) {
- CIRCLEQ_INSERT_HEAD(&nqtimerhead, lp, lc_timer);
- } else {
- CIRCLEQ_INSERT_AFTER(&nqtimerhead, tlp, lp, lc_timer);
- }
-}
-
-/*
- * Compare the requesting host address with the lph entry in the lease.
- * Return true iff it is the same.
- * This is somewhat messy due to the union in the nqhost structure.
- * The local host is indicated by the special value of NQLOCALSLP for slp.
- */
-int
-nqsrv_cmpnam(slp, nam, lph)
- register struct nfssvc_sock *slp;
- struct mbuf *nam;
- register struct nqhost *lph;
-{
- register struct sockaddr_in *saddr;
- struct mbuf *addr;
- union nethostaddr lhaddr;
- int ret;
-
- if (slp == NQLOCALSLP) {
- if (lph->lph_flag & LC_LOCAL)
- return (1);
- else
- return (0);
- }
- if (slp == nfs_udpsock || slp == nfs_cltpsock)
- addr = nam;
- else
- addr = slp->ns_nam;
- if (lph->lph_flag & LC_UDP)
- ret = netaddr_match(AF_INET, &lph->lph_haddr, addr);
- else if (lph->lph_flag & LC_CLTP)
- ret = netaddr_match(AF_ISO, &lph->lph_claddr, addr);
- else {
- if ((lph->lph_slp->ns_flag & SLP_VALID) == 0)
- return (0);
- saddr = mtod(lph->lph_slp->ns_nam, struct sockaddr_in *);
- if (saddr->sin_family == AF_INET)
- lhaddr.had_inetaddr = saddr->sin_addr.s_addr;
- else
- lhaddr.had_nam = lph->lph_slp->ns_nam;
- ret = netaddr_match(saddr->sin_family, &lhaddr, addr);
- }
- return (ret);
-}
-
-/*
- * Send out eviction notice messages to all other hosts for the lease.
- */
-void
-nqsrv_send_eviction(vp, lp, slp, nam, cred)
- struct vnode *vp;
- register struct nqlease *lp;
- struct nfssvc_sock *slp;
- struct mbuf *nam;
- struct ucred *cred;
-{
- register struct nqhost *lph = &lp->lc_host;
- register struct mbuf *m;
- register int siz;
- struct nqm *lphnext = lp->lc_morehosts;
- struct mbuf *mreq, *mb, *mb2, *nam2, *mheadend;
- struct socket *so;
- struct sockaddr_in *saddr;
- nfsfh_t nfh;
- fhandle_t *fhp;
- caddr_t bpos, cp;
- u_int32_t xid, *tl;
- int len = 1, ok = 1, i = 0;
- int sotype, *solockp;
-
- while (ok && (lph->lph_flag & LC_VALID)) {
- if (nqsrv_cmpnam(slp, nam, lph))
- lph->lph_flag |= LC_VACATED;
- else if ((lph->lph_flag & (LC_LOCAL | LC_VACATED)) == 0) {
- if (lph->lph_flag & LC_UDP) {
- MGET(nam2, M_WAIT, MT_SONAME);
- saddr = mtod(nam2, struct sockaddr_in *);
- nam2->m_len = saddr->sin_len =
- sizeof (struct sockaddr_in);
- saddr->sin_family = AF_INET;
- saddr->sin_addr.s_addr = lph->lph_inetaddr;
- saddr->sin_port = lph->lph_port;
- so = nfs_udpsock->ns_so;
- } else if (lph->lph_flag & LC_CLTP) {
- nam2 = lph->lph_nam;
- so = nfs_cltpsock->ns_so;
- } else if (lph->lph_slp->ns_flag & SLP_VALID) {
- nam2 = (struct mbuf *)0;
- so = lph->lph_slp->ns_so;
- } else
- goto nextone;
- sotype = so->so_type;
- if (so->so_proto->pr_flags & PR_CONNREQUIRED)
- solockp = &lph->lph_slp->ns_solock;
- else
- solockp = (int *)0;
- nfsm_reqhead((struct vnode *)0, NQNFSPROC_EVICTED,
- NFSX_V3FH + NFSX_UNSIGNED);
- fhp = &nfh.fh_generic;
- bzero((caddr_t)fhp, sizeof(nfh));
- fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
- VFS_VPTOFH(vp, &fhp->fh_fid);
- nfsm_srvfhtom(fhp, 1);
- m = mreq;
- siz = 0;
- while (m) {
- siz += m->m_len;
- m = m->m_next;
- }
- if (siz <= 0 || siz > NFS_MAXPACKET) {
- printf("mbuf siz=%d\n",siz);
- panic("Bad nfs svc reply");
- }
- m = nfsm_rpchead(cred, (NFSMNT_NFSV3 | NFSMNT_NQNFS),
- NQNFSPROC_EVICTED,
- RPCAUTH_UNIX, 5 * NFSX_UNSIGNED, (char *)0,
- 0, (char *)0, mreq, siz, &mheadend, &xid);
- /*
- * For stream protocols, prepend a Sun RPC
- * Record Mark.
- */
- if (sotype == SOCK_STREAM) {
- M_PREPEND(m, NFSX_UNSIGNED, M_WAIT);
- *mtod(m, u_int32_t *) = htonl(0x80000000 |
- (m->m_pkthdr.len - NFSX_UNSIGNED));
- }
- if (((lph->lph_flag & (LC_UDP | LC_CLTP)) == 0 &&
- (lph->lph_slp->ns_flag & SLP_VALID) == 0) ||
- (solockp && (*solockp & NFSMNT_SNDLOCK)))
- m_freem(m);
- else {
- if (solockp)
- *solockp |= NFSMNT_SNDLOCK;
- (void) nfs_send(so, nam2, m,
- (struct nfsreq *)0);
- if (solockp)
- nfs_sndunlock(solockp);
- }
- if (lph->lph_flag & LC_UDP)
- MFREE(nam2, m);
- }
-nextone:
- if (++i == len) {
- if (lphnext) {
- i = 0;
- len = LC_MOREHOSTSIZ;
- lph = lphnext->lpm_hosts;
- lphnext = lphnext->lpm_next;
- } else
- ok = 0;
- } else
- lph++;
- }
-}
-
-/*
- * Wait for the lease to expire.
- * This will occur when all clients have sent "vacated" messages to
- * this server OR when it expires do to timeout.
- */
-void
-nqsrv_waitfor_expiry(lp)
- register struct nqlease *lp;
-{
- register struct nqhost *lph;
- register int i;
- struct nqm *lphnext;
- int len, ok;
-
-tryagain:
- if (time.tv_sec > lp->lc_expiry)
- return;
- lph = &lp->lc_host;
- lphnext = lp->lc_morehosts;
- len = 1;
- i = 0;
- ok = 1;
- while (ok && (lph->lph_flag & LC_VALID)) {
- if ((lph->lph_flag & (LC_LOCAL | LC_VACATED)) == 0) {
- lp->lc_flag |= LC_EXPIREDWANTED;
- (void) tsleep((caddr_t)&lp->lc_flag, PSOCK,
- "nqexp", 0);
- goto tryagain;
- }
- if (++i == len) {
- if (lphnext) {
- i = 0;
- len = LC_MOREHOSTSIZ;
- lph = lphnext->lpm_hosts;
- lphnext = lphnext->lpm_next;
- } else
- ok = 0;
- } else
- lph++;
- }
-}
-
-#ifdef NFSSERVER
-/*
- * Nqnfs server timer that maintains the server lease queue.
- * Scan the lease queue for expired entries:
- * - when one is found, wakeup anyone waiting for it
- * else dequeue and free
- */
-void
-nqnfs_serverd()
-{
- register struct nqlease *lp;
- register struct nqhost *lph;
- struct nqlease *nextlp;
- struct nqm *lphnext, *olphnext;
- struct mbuf *n;
- int i, len, ok;
-
- for (lp = nqtimerhead.cqh_first; lp != (void *)&nqtimerhead;
- lp = nextlp) {
- if (lp->lc_expiry >= time.tv_sec)
- break;
- nextlp = lp->lc_timer.cqe_next;
- if (lp->lc_flag & LC_EXPIREDWANTED) {
- lp->lc_flag &= ~LC_EXPIREDWANTED;
- wakeup((caddr_t)&lp->lc_flag);
- } else if ((lp->lc_flag & (LC_LOCKED | LC_WANTED)) == 0) {
- /*
- * Make a best effort at keeping a write caching lease long
- * enough by not deleting it until it has been explicitly
- * vacated or there have been no writes in the previous
- * write_slack seconds since expiry and the nfsds are not
- * all busy. The assumption is that if the nfsds are not
- * all busy now (no queue of nfs requests), then the client
- * would have been able to do at least one write to the
- * file during the last write_slack seconds if it was still
- * trying to push writes to the server.
- */
- if ((lp->lc_flag & (LC_WRITE | LC_VACATED)) == LC_WRITE &&
- ((lp->lc_flag & LC_WRITTEN) || nfsd_waiting == 0)) {
- lp->lc_flag &= ~LC_WRITTEN;
- nqsrv_instimeq(lp, nqsrv_writeslack);
- } else {
- CIRCLEQ_REMOVE(&nqtimerhead, lp, lc_timer);
- LIST_REMOVE(lp, lc_hash);
- lph = &lp->lc_host;
- lphnext = lp->lc_morehosts;
- olphnext = (struct nqm *)0;
- len = 1;
- i = 0;
- ok = 1;
- while (ok && (lph->lph_flag & LC_VALID)) {
- if (lph->lph_flag & LC_CLTP)
- MFREE(lph->lph_nam, n);
- if (lph->lph_flag & LC_SREF)
- nfsrv_slpderef(lph->lph_slp);
- if (++i == len) {
- if (olphnext) {
- free((caddr_t)olphnext, M_NQMHOST);
- olphnext = (struct nqm *)0;
- }
- if (lphnext) {
- olphnext = lphnext;
- i = 0;
- len = LC_MOREHOSTSIZ;
- lph = lphnext->lpm_hosts;
- lphnext = lphnext->lpm_next;
- } else
- ok = 0;
- } else
- lph++;
- }
- FREE((caddr_t)lp, M_NQLEASE);
- if (olphnext)
- free((caddr_t)olphnext, M_NQMHOST);
- nfsstats.srvnqnfs_leases--;
- }
- }
- }
-}
-
-/*
- * Called from nfssvc_nfsd() for a getlease rpc request.
- * Do the from/to xdr translation and call nqsrv_getlease() to
- * do the real work.
- */
-int
-nqnfsrv_getlease(nfsd, slp, procp, mrq)
- struct nfsrv_descript *nfsd;
- struct nfssvc_sock *slp;
- struct proc *procp;
- struct mbuf **mrq;
-{
- struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
- caddr_t dpos = nfsd->nd_dpos;
- struct ucred *cred = &nfsd->nd_cr;
- register struct nfs_fattr *fp;
- struct vattr va;
- struct vnode *vp;
- nfsfh_t nfh;
- fhandle_t *fhp;
- register u_int32_t *tl;
- register int32_t t1;
- u_quad_t frev;
- caddr_t bpos;
- int error = 0;
- char *cp2;
- struct mbuf *mb, *mb2, *mreq;
- int flags, rdonly, cache;
-
- fhp = &nfh.fh_generic;
- nfsm_srvmtofh(fhp);
- nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
- flags = fxdr_unsigned(int, *tl++);
- nfsd->nd_duration = fxdr_unsigned(int, *tl);
- error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly,
- (nfsd->nd_flag & ND_KERBAUTH));
- if (error)
- nfsm_reply(0);
- if (rdonly && flags == ND_WRITE) {
- vput(vp);
- error = EROFS;
- nfsm_reply(0);
- }
- (void) nqsrv_getlease(vp, &nfsd->nd_duration, flags, slp, procp,
- nam, &cache, &frev, cred);
- error = VOP_GETATTR(vp, &va, cred, procp);
- vput(vp);
- nfsm_reply(NFSX_V3FATTR + 4 * NFSX_UNSIGNED);
- nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
- *tl++ = txdr_unsigned(cache);
- *tl++ = txdr_unsigned(nfsd->nd_duration);
- txdr_hyper(frev, tl);
- nfsm_build(fp, struct nfs_fattr *, NFSX_V3FATTR);
- nfsm_srvfillattr(&va, fp);
- nfsm_srvdone;
-}
-
-/*
- * Called from nfssvc_nfsd() when a "vacated" message is received from a
- * client. Find the entry and expire it.
- */
-int
-nqnfsrv_vacated(nfsd, slp, procp, mrq)
- struct nfsrv_descript *nfsd;
- struct nfssvc_sock *slp;
- struct proc *procp;
- struct mbuf **mrq;
-{
- struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md;
- struct mbuf *nam = nfsd->nd_nam;
- caddr_t dpos = nfsd->nd_dpos;
- register struct nqlease *lp;
- register struct nqhost *lph;
- struct nqlease *tlp = (struct nqlease *)0;
- nfsfh_t nfh;
- fhandle_t *fhp;
- register u_int32_t *tl;
- register int32_t t1;
- struct nqm *lphnext;
- struct mbuf *mreq, *mb;
- int error = 0, i, len, ok, gotit = 0, cache = 0;
- char *cp2, *bpos;
- u_quad_t frev;
-
- fhp = &nfh.fh_generic;
- nfsm_srvmtofh(fhp);
- m_freem(mrep);
- /*
- * Find the lease by searching the hash list.
- */
- for (lp = NQFHHASH(fhp->fh_fid.fid_data)->lh_first; lp != 0;
- lp = lp->lc_hash.le_next)
- if (fhp->fh_fsid.val[0] == lp->lc_fsid.val[0] &&
- fhp->fh_fsid.val[1] == lp->lc_fsid.val[1] &&
- !bcmp(fhp->fh_fid.fid_data, lp->lc_fiddata,
- MAXFIDSZ)) {
- /* Found it */
- tlp = lp;
- break;
- }
- if (tlp != 0) {
- lp = tlp;
- len = 1;
- i = 0;
- lph = &lp->lc_host;
- lphnext = lp->lc_morehosts;
- ok = 1;
- while (ok && (lph->lph_flag & LC_VALID)) {
- if (nqsrv_cmpnam(slp, nam, lph)) {
- lph->lph_flag |= LC_VACATED;
- gotit++;
- break;
- }
- if (++i == len) {
- if (lphnext) {
- len = LC_MOREHOSTSIZ;
- i = 0;
- lph = lphnext->lpm_hosts;
- lphnext = lphnext->lpm_next;
- } else
- ok = 0;
- } else
- lph++;
- }
- if ((lp->lc_flag & LC_EXPIREDWANTED) && gotit) {
- lp->lc_flag &= ~LC_EXPIREDWANTED;
- wakeup((caddr_t)&lp->lc_flag);
- }
-nfsmout:
- return (EPERM);
- }
- return (EPERM);
-}
-#endif /* NFSSERVER */
-
-#ifdef NFSCLIENT
-/*
- * Client get lease rpc function.
- */
-int
-nqnfs_getlease(vp, rwflag, cred, p)
- register struct vnode *vp;
- int rwflag;
- struct ucred *cred;
- struct proc *p;
-{
- register u_int32_t *tl;
- register caddr_t cp;
- register int32_t t1, t2;
- register struct nfsnode *np;
- struct nfsmount *nmp = VFSTONFS(vp->v_mount);
- caddr_t bpos, dpos, cp2;
- time_t reqtime;
- int error = 0;
- struct mbuf *mreq, *mrep, *md, *mb, *mb2;
- int cachable;
- u_quad_t frev;
-
- nfsstats.rpccnt[NQNFSPROC_GETLEASE]++;
- mb = mreq = nfsm_reqh(vp, NQNFSPROC_GETLEASE, NFSX_V3FH+2*NFSX_UNSIGNED,
- &bpos);
- nfsm_fhtom(vp, 1);
- nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
- *tl++ = txdr_unsigned(rwflag);
- *tl = txdr_unsigned(nmp->nm_leaseterm);
- reqtime = time.tv_sec;
- nfsm_request(vp, NQNFSPROC_GETLEASE, p, cred);
- np = VTONFS(vp);
- nfsm_dissect(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
- cachable = fxdr_unsigned(int, *tl++);
- reqtime += fxdr_unsigned(int, *tl++);
- if (reqtime > time.tv_sec) {
- frev = fxdr_hyper(tl);
- nqnfs_clientlease(nmp, np, rwflag, cachable, reqtime, frev);
- nfsm_loadattr(vp, (struct vattr *)0);
- } else
- error = NQNFS_EXPIRED;
- nfsm_reqdone;
- return (error);
-}
-
-/*
- * Client vacated message function.
- */
-int
-nqnfs_vacated(vp, cred)
- register struct vnode *vp;
- struct ucred *cred;
-{
- register caddr_t cp;
- register struct mbuf *m;
- register int i;
- register u_int32_t *tl;
- register int32_t t2;
- caddr_t bpos;
- u_int32_t xid;
- int error = 0;
- struct mbuf *mreq, *mb, *mb2, *mheadend;
- struct nfsmount *nmp;
- struct nfsreq myrep;
-
- nmp = VFSTONFS(vp->v_mount);
- nfsstats.rpccnt[NQNFSPROC_VACATED]++;
- nfsm_reqhead(vp, NQNFSPROC_VACATED, NFSX_FH(1));
- nfsm_fhtom(vp, 1);
- m = mreq;
- i = 0;
- while (m) {
- i += m->m_len;
- m = m->m_next;
- }
- m = nfsm_rpchead(cred, nmp->nm_flag, NQNFSPROC_VACATED,
- RPCAUTH_UNIX, 5 * NFSX_UNSIGNED, (char *)0,
- 0, (char *)0, mreq, i, &mheadend, &xid);
- if (nmp->nm_sotype == SOCK_STREAM) {
- M_PREPEND(m, NFSX_UNSIGNED, M_WAIT);
- *mtod(m, u_int32_t *) = htonl(0x80000000 | (m->m_pkthdr.len -
- NFSX_UNSIGNED));
- }
- myrep.r_flags = 0;
- myrep.r_nmp = nmp;
- if (nmp->nm_soflags & PR_CONNREQUIRED)
- (void) nfs_sndlock(&nmp->nm_flag, (struct nfsreq *)0);
- (void) nfs_send(nmp->nm_so, nmp->nm_nam, m, &myrep);
- if (nmp->nm_soflags & PR_CONNREQUIRED)
- nfs_sndunlock(&nmp->nm_flag);
-nfsmout:
- return (error);
-}
-
-/*
- * Called for client side callbacks
- */
-int
-nqnfs_callback(nmp, mrep, md, dpos)
- struct nfsmount *nmp;
- struct mbuf *mrep, *md;
- caddr_t dpos;
-{
- register struct vnode *vp;
- register u_int32_t *tl;
- register int32_t t1;
- nfsfh_t nfh;
- fhandle_t *fhp;
- struct nfsnode *np;
- struct nfsd tnfsd;
- struct nfssvc_sock *slp;
- struct nfsrv_descript ndesc;
- register struct nfsrv_descript *nfsd = &ndesc;
- struct mbuf **mrq = (struct mbuf **)0, *mb, *mreq;
- int error = 0, cache = 0;
- char *cp2, *bpos;
- u_quad_t frev;
-
-#ifndef nolint
- slp = NULL;
-#endif
- nfsd->nd_mrep = mrep;
- nfsd->nd_md = md;
- nfsd->nd_dpos = dpos;
- error = nfs_getreq(nfsd, &tnfsd, FALSE);
- if (error)
- return (error);
- md = nfsd->nd_md;
- dpos = nfsd->nd_dpos;
- if (nfsd->nd_procnum != NQNFSPROC_EVICTED) {
- m_freem(mrep);
- return (EPERM);
- }
- fhp = &nfh.fh_generic;
- nfsm_srvmtofh(fhp);
- m_freem(mrep);
- error = nfs_nget(nmp->nm_mountp, (nfsfh_t *)fhp, NFSX_V3FH, &np);
- if (error)
- return (error);
- vp = NFSTOV(np);
- if (np->n_timer.cqe_next != 0) {
- np->n_expiry = 0;
- np->n_flag |= NQNFSEVICTED;
- if (nmp->nm_timerhead.cqh_first != np) {
- CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
- CIRCLEQ_INSERT_HEAD(&nmp->nm_timerhead, np, n_timer);
- }
- }
- vrele(vp);
- nfsm_srvdone;
-}
-
-/*
- * Nqnfs client helper daemon. Runs once a second to expire leases.
- * It also get authorization strings for "kerb" mounts.
- * It must start at the beginning of the list again after any potential
- * "sleep" since nfs_reclaim() called from vclean() can pull a node off
- * the list asynchronously.
- */
-int
-nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
- register struct nfsmount *nmp;
- struct ucred *cred;
- struct nfsd_cargs *ncd;
- int flag;
- caddr_t argp;
- struct proc *p;
-{
- register struct nfsnode *np;
- struct vnode *vp;
- struct nfsreq myrep;
- struct nfsuid *nuidp, *nnuidp;
- int error = 0, vpid;
-
- /*
- * First initialize some variables
- */
-
- /*
- * If an authorization string is being passed in, get it.
- */
- if ((flag & NFSSVC_GOTAUTH) &&
- (nmp->nm_flag & (NFSMNT_WAITAUTH | NFSMNT_DISMNT)) == 0) {
- if (nmp->nm_flag & NFSMNT_HASAUTH)
- panic("cld kerb");
- if ((flag & NFSSVC_AUTHINFAIL) == 0) {
- if (ncd->ncd_authlen <= nmp->nm_authlen &&
- ncd->ncd_verflen <= nmp->nm_verflen &&
- !copyin(ncd->ncd_authstr,nmp->nm_authstr,ncd->ncd_authlen)&&
- !copyin(ncd->ncd_verfstr,nmp->nm_verfstr,ncd->ncd_verflen)){
- nmp->nm_authtype = ncd->ncd_authtype;
- nmp->nm_authlen = ncd->ncd_authlen;
- nmp->nm_verflen = ncd->ncd_verflen;
-#ifdef NFSKERB
- nmp->nm_key = ncd->ncd_key;
-#endif
- } else
- nmp->nm_flag |= NFSMNT_AUTHERR;
- } else
- nmp->nm_flag |= NFSMNT_AUTHERR;
- nmp->nm_flag |= NFSMNT_HASAUTH;
- wakeup((caddr_t)&nmp->nm_authlen);
- } else
- nmp->nm_flag |= NFSMNT_WAITAUTH;
-
- /*
- * Loop every second updating queue until there is a termination sig.
- */
- while ((nmp->nm_flag & NFSMNT_DISMNT) == 0) {
- if (nmp->nm_flag & NFSMNT_NQNFS) {
- /*
- * If there are no outstanding requests (and therefore no
- * processes in nfs_reply) and there is data in the receive
- * queue, poke for callbacks.
- */
- if (nfs_reqq.tqh_first == 0 && nmp->nm_so &&
- nmp->nm_so->so_rcv.sb_cc > 0) {
- myrep.r_flags = R_GETONEREP;
- myrep.r_nmp = nmp;
- myrep.r_mrep = (struct mbuf *)0;
- myrep.r_procp = (struct proc *)0;
- (void) nfs_reply(&myrep);
- }
-
- /*
- * Loop through the leases, updating as required.
- */
- np = nmp->nm_timerhead.cqh_first;
- while (np != (void *)&nmp->nm_timerhead &&
- (nmp->nm_flag & NFSMNT_DISMINPROG) == 0) {
- vp = NFSTOV(np);
- vpid = vp->v_id;
- if (np->n_expiry < time.tv_sec) {
- if (vget(vp, LK_EXCLUSIVE, p) == 0) {
- nmp->nm_inprog = vp;
- if (vpid == vp->v_id) {
- CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
- np->n_timer.cqe_next = 0;
- if (np->n_flag & (NMODIFIED | NQNFSEVICTED)) {
- if (np->n_flag & NQNFSEVICTED) {
- if (vp->v_type == VDIR) {
- np->n_direofoffset = 0;
- }
- cache_purge(vp);
- (void) nfs_vinvalbuf(vp,
- V_SAVE, cred, p, 0);
- np->n_flag &= ~NQNFSEVICTED;
- (void) nqnfs_vacated(vp, cred);
- } else if (vp->v_type == VREG) {
- (void) VOP_FSYNC(vp, cred,
- MNT_WAIT, p);
- np->n_flag &= ~NMODIFIED;
- }
- }
- }
- vrele(vp);
- nmp->nm_inprog = NULLVP;
- }
- } else if ((np->n_expiry - NQ_RENEWAL) < time.tv_sec) {
- if ((np->n_flag & (NQNFSWRITE | NQNFSNONCACHE))
- == NQNFSWRITE && vp->v_dirtyblkhd.lh_first &&
- vget(vp, LK_EXCLUSIVE, p) == 0) {
- nmp->nm_inprog = vp;
- if (vpid == vp->v_id &&
- nqnfs_getlease(vp, ND_WRITE, cred, p)==0)
- np->n_brev = np->n_lrev;
- vrele(vp);
- nmp->nm_inprog = NULLVP;
- }
- } else
- break;
- if (np == nmp->nm_timerhead.cqh_first)
- break;
- np = nmp->nm_timerhead.cqh_first;
- }
- }
-
- /*
- * Get an authorization string, if required.
- */
- if ((nmp->nm_flag & (NFSMNT_WAITAUTH | NFSMNT_DISMNT | NFSMNT_HASAUTH)) == 0) {
- ncd->ncd_authuid = nmp->nm_authuid;
- if (copyout((caddr_t)ncd, argp, sizeof (struct nfsd_cargs)))
- nmp->nm_flag |= NFSMNT_WAITAUTH;
- else
- return (ENEEDAUTH);
- }
-
- /*
- * Wait a bit (no pun) and do it again.
- */
- if ((nmp->nm_flag & NFSMNT_DISMNT) == 0 &&
- (nmp->nm_flag & (NFSMNT_WAITAUTH | NFSMNT_HASAUTH))) {
- error = tsleep((caddr_t)&nmp->nm_authstr, PSOCK | PCATCH,
- "nqnfstimr", hz / 3);
- if (error == EINTR || error == ERESTART)
- (void) dounmount(nmp->nm_mountp, MNT_FORCE, p);
- }
- }
-
- /*
- * Finally, we can free up the mount structure.
- */
- for (nuidp = nmp->nm_uidlruhead.tqh_first; nuidp != 0; nuidp = nnuidp) {
- nnuidp = nuidp->nu_lru.tqe_next;
- LIST_REMOVE(nuidp, nu_hash);
- TAILQ_REMOVE(&nmp->nm_uidlruhead, nuidp, nu_lru);
- free((caddr_t)nuidp, M_NFSUID);
- }
- free((caddr_t)nmp, M_NFSMNT);
- if (error == EWOULDBLOCK)
- error = 0;
- return (error);
-}
-
-/*
- * Update a client lease.
- */
-void
-nqnfs_clientlease(nmp, np, rwflag, cachable, expiry, frev)
- register struct nfsmount *nmp;
- register struct nfsnode *np;
- int rwflag, cachable;
- time_t expiry;
- u_quad_t frev;
-{
- register struct nfsnode *tp;
-
- if (np->n_timer.cqe_next != 0) {
- CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
- if (rwflag == ND_WRITE)
- np->n_flag |= NQNFSWRITE;
- } else if (rwflag == ND_READ)
- np->n_flag &= ~NQNFSWRITE;
- else
- np->n_flag |= NQNFSWRITE;
- if (cachable)
- np->n_flag &= ~NQNFSNONCACHE;
- else
- np->n_flag |= NQNFSNONCACHE;
- np->n_expiry = expiry;
- np->n_lrev = frev;
- tp = nmp->nm_timerhead.cqh_last;
- while (tp != (void *)&nmp->nm_timerhead && tp->n_expiry > np->n_expiry)
- tp = tp->n_timer.cqe_prev;
- if (tp == (void *)&nmp->nm_timerhead) {
- CIRCLEQ_INSERT_HEAD(&nmp->nm_timerhead, np, n_timer);
- } else {
- CIRCLEQ_INSERT_AFTER(&nmp->nm_timerhead, tp, np, n_timer);
- }
-}
-#endif /* NFSCLIENT */
-
-/*
- * Adjust all timer queue expiry times when the time of day clock is changed.
- * Called from the settimeofday() syscall.
- */
-void
-nqnfs_lease_updatetime(deltat)
- register int deltat;
-{
- register struct nqlease *lp;
- register struct nfsnode *np;
- struct mount *mp;
- struct nfsmount *nmp;
- int s;
- struct proc *p = curproc; /* XXX */
- struct mount *nxtmp;
-
- if (nqnfsstarttime != 0)
- nqnfsstarttime += deltat;
- s = splsoftclock();
- for (lp = nqtimerhead.cqh_first; lp != (void *)&nqtimerhead;
- lp = lp->lc_timer.cqe_next)
- lp->lc_expiry += deltat;
- splx(s);
-
- /*
- * Search the mount list for all nqnfs mounts and do their timer
- * queues.
- */
- simple_lock(&mountlist_slock);
- for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nxtmp) {
- if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) {
- nxtmp = mp->mnt_list.cqe_next;
- continue;
- }
- if (!strncmp(&mp->mnt_stat.f_fstypename[0], MOUNT_NFS,
- MFSNAMELEN)) {
- nmp = VFSTONFS(mp);
- if (nmp->nm_flag & NFSMNT_NQNFS) {
- for (np = nmp->nm_timerhead.cqh_first;
- np != (void *)&nmp->nm_timerhead;
- np = np->n_timer.cqe_next) {
- np->n_expiry += deltat;
- }
- }
- }
- simple_lock(&mountlist_slock);
- nxtmp = mp->mnt_list.cqe_next;
- vfs_unbusy(mp, p);
- }
- simple_unlock(&mountlist_slock);
-}
-
-/*
- * Lock a server lease.
- */
-void
-nqsrv_locklease(lp)
- struct nqlease *lp;
-{
-
- while (lp->lc_flag & LC_LOCKED) {
- lp->lc_flag |= LC_WANTED;
- (void) tsleep((caddr_t)lp, PSOCK, "nqlc", 0);
- }
- lp->lc_flag |= LC_LOCKED;
- lp->lc_flag &= ~LC_WANTED;
-}
-
-/*
- * Unlock a server lease.
- */
-void
-nqsrv_unlocklease(lp)
- struct nqlease *lp;
-{
-
- lp->lc_flag &= ~LC_LOCKED;
- if (lp->lc_flag & LC_WANTED)
- wakeup((caddr_t)lp);
-}
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 77551a159c1..bbec7502a49 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_serv.c,v 1.21 2001/03/25 08:26:17 csapuntz Exp $ */
+/* $OpenBSD: nfs_serv.c,v 1.22 2001/06/25 03:28:08 csapuntz Exp $ */
/* $NetBSD: nfs_serv.c,v 1.25 1996/03/02 15:55:52 jtk Exp $ */
/*
@@ -81,7 +81,6 @@
#include <nfs/nfs.h>
#include <nfs/xdr_subs.h>
#include <nfs/nfsm_subs.h>
-#include <nfs/nqnfs.h>
#include <nfs/nfs_var.h>
/* Global vars */
@@ -193,7 +192,6 @@ nfsrv_getattr(nfsd, slp, procp, mrq)
nfsm_reply(0);
return (0);
}
- nqsrv_getl(vp, ND_READ);
error = VOP_GETATTR(vp, &va, cred, procp);
vput(vp);
nfsm_reply(NFSX_FATTR(nfsd->nd_flag & ND_NFSV3));
@@ -286,7 +284,6 @@ nfsrv_setattr(nfsd, slp, procp, mrq)
nfsm_srvwcc_data(preat_ret, &preat, postat_ret, &va);
return (0);
}
- nqsrv_getl(vp, ND_WRITE);
if (v3) {
error = preat_ret = VOP_GETATTR(vp, &preat, cred, procp);
if (!error && gcheck &&
@@ -384,7 +381,6 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
nfsm_srvpostop_attr(dirattr_ret, &dirattr);
return (0);
}
- nqsrv_getl(nd.ni_startdir, ND_READ);
vrele(nd.ni_startdir);
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
vp = nd.ni_vp;
@@ -487,7 +483,6 @@ nfsrv_readlink(nfsd, slp, procp, mrq)
error = ENXIO;
goto out;
}
- nqsrv_getl(vp, ND_READ);
error = VOP_READLINK(vp, uiop, cred);
out:
getret = VOP_GETATTR(vp, &attr, cred, procp);
@@ -570,7 +565,6 @@ nfsrv_read(nfsd, slp, procp, mrq)
error = (vp->v_type == VDIR) ? EISDIR : EACCES;
}
if (!error) {
- nqsrv_getl(vp, ND_READ);
if ((error = nfsrv_access(vp, VREAD, cred, rdonly, procp, 1)) != 0)
error = nfsrv_access(vp, VEXEC, cred, rdonly, procp, 1);
}
@@ -785,7 +779,6 @@ nfsrv_write(nfsd, slp, procp, mrq)
error = (vp->v_type == VDIR) ? EISDIR : EACCES;
}
if (!error) {
- nqsrv_getl(vp, ND_WRITE);
error = nfsrv_access(vp, VWRITE, cred, rdonly, procp, 1);
}
if (error) {
@@ -1050,7 +1043,6 @@ loop1:
} else
vp = NULL;
if (!error) {
- nqsrv_getl(vp, ND_WRITE);
error = nfsrv_access(vp, VWRITE, cred, rdonly, procp, 1);
}
@@ -1323,7 +1315,6 @@ nfsrv_create(nfsd, slp, procp, mrq)
if (nd.ni_vp == NULL) {
if (va.va_type == VREG || va.va_type == VSOCK) {
vrele(nd.ni_startdir);
- nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
if (!error) {
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
@@ -1350,7 +1341,6 @@ nfsrv_create(nfsd, slp, procp, mrq)
return (0);
} else
va.va_rdev = (dev_t)rdev;
- nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd,
&va);
if (error) {
@@ -1399,7 +1389,6 @@ nfsrv_create(nfsd, slp, procp, mrq)
error = nfsrv_access(vp, VWRITE, cred,
(nd.ni_cnd.cn_flags & RDONLY), procp, 0);
if (!error) {
- nqsrv_getl(vp, ND_WRITE);
tempsize = va.va_size;
VATTR_NULL(&va);
va.va_size = tempsize;
@@ -1535,7 +1524,6 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
va.va_type = vtyp;
if (vtyp == VSOCK) {
vrele(nd.ni_startdir);
- nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
if (!error)
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
@@ -1548,7 +1536,6 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
vput(nd.ni_dvp);
goto out;
}
- nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
if (error) {
vrele(nd.ni_startdir);
@@ -1671,8 +1658,6 @@ nfsrv_remove(nfsd, slp, procp, mrq)
#endif
out:
if (!error) {
- nqsrv_getl(nd.ni_dvp, ND_WRITE);
- nqsrv_getl(vp, ND_WRITE);
error = VOP_REMOVE(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
} else {
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -1820,10 +1805,6 @@ nfsrv_rename(nfsd, slp, procp, mrq)
error = -1;
out:
if (!error) {
- nqsrv_getl(fromnd.ni_dvp, ND_WRITE);
- nqsrv_getl(tdvp, ND_WRITE);
- if (tvp)
- nqsrv_getl(tvp, ND_WRITE);
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
} else {
@@ -1948,8 +1929,6 @@ nfsrv_link(nfsd, slp, procp, mrq)
error = EXDEV;
out:
if (!error) {
- nqsrv_getl(vp, ND_WRITE);
- nqsrv_getl(xp, ND_WRITE);
error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
} else {
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -2059,7 +2038,6 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
error = EEXIST;
goto out;
}
- nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va, pathcp);
if (error)
vrele(nd.ni_startdir);
@@ -2192,7 +2170,6 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
error = EEXIST;
goto out;
}
- nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va);
if (!error) {
vp = nd.ni_vp;
@@ -2305,8 +2282,6 @@ nfsrv_rmdir(nfsd, slp, procp, mrq)
error = EBUSY;
out:
if (!error) {
- nqsrv_getl(nd.ni_dvp, ND_WRITE);
- nqsrv_getl(vp, ND_WRITE);
error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
} else {
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -2426,7 +2401,6 @@ nfsrv_readdir(nfsd, slp, procp, mrq)
nfsm_srvpostop_attr(getret, &at);
return (0);
}
- nqsrv_getl(vp, ND_READ);
if (v3) {
error = getret = VOP_GETATTR(vp, &at, cred, procp);
#ifdef NFS3_STRICTVERF
@@ -2694,7 +2668,6 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq)
error = NFSERR_BAD_COOKIE;
#endif
if (!error) {
- nqsrv_getl(vp, ND_READ);
error = nfsrv_access(vp, VEXEC, cred, rdonly, procp, 0);
}
if (error) {
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index d42f5d54b74..8f52565b268 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.21 2001/05/20 08:32:35 angelos Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.22 2001/06/25 03:28:09 csapuntz Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -69,7 +69,6 @@
#include <nfs/nfsmount.h>
#include <nfs/nfsnode.h>
#include <nfs/nfsrtt.h>
-#include <nfs/nqnfs.h>
#include <nfs/nfs_var.h>
#define TRUE 1
@@ -100,8 +99,7 @@
extern u_int32_t rpc_reply, rpc_msgdenied, rpc_mismatch, rpc_vers,
rpc_auth_unix, rpc_msgaccepted, rpc_call, rpc_autherr,
rpc_auth_kerb;
-extern u_int32_t nfs_prog, nqnfs_prog;
-extern time_t nqnfsstarttime;
+extern u_int32_t nfs_prog;
extern struct nfsstats nfsstats;
extern int nfsv3_procid[NFS_NPROCS];
extern int nfs_ticks;
@@ -698,13 +696,8 @@ nfs_reply(myrep)
nfsm_dissect(tl, u_int32_t *, 2*NFSX_UNSIGNED);
rxid = *tl++;
if (*tl != rpc_reply) {
- if (nmp->nm_flag & NFSMNT_NQNFS) {
- if (nqnfs_callback(nmp, mrep, md, dpos))
- nfsstats.rpcinvalid++;
- } else {
- nfsstats.rpcinvalid++;
- m_freem(mrep);
- }
+ nfsstats.rpcinvalid++;
+ m_freem(mrep);
nfsmout:
if (myrep->r_flags & R_GETONEREP)
return (0);
@@ -823,15 +816,13 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
register int i;
struct nfsmount *nmp;
struct mbuf *md, *mheadend;
- struct nfsnode *np;
char nickv[RPCX_NICKVERF];
time_t reqtime, waituntil;
caddr_t dpos, cp2;
- int t1, nqlflag, cachable, s, error = 0, mrest_len, auth_len, auth_type;
- int trylater_delay = NQ_TRYLATERDEL, trylater_cnt = 0, failed_auth = 0;
+ int t1, s, error = 0, mrest_len, auth_len, auth_type;
+ int trylater_delay = 15, trylater_cnt = 0, failed_auth = 0;
int verf_len, verf_type;
u_int32_t xid;
- u_quad_t frev;
char *auth_str, *verf_str;
NFSKERBKEY_T key; /* save session key */
@@ -1053,24 +1044,6 @@ tryagain:
return (error);
}
- /*
- * For nqnfs, get any lease in reply
- */
- if (nmp->nm_flag & NFSMNT_NQNFS) {
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
- if (*tl) {
- np = VTONFS(vp);
- nqlflag = fxdr_unsigned(int, *tl);
- nfsm_dissect(tl, u_int32_t *, 4*NFSX_UNSIGNED);
- cachable = fxdr_unsigned(int, *tl++);
- reqtime += fxdr_unsigned(int, *tl++);
- if (reqtime > time.tv_sec) {
- frev = fxdr_hyper(tl);
- nqnfs_clientlease(nmp, np, nqlflag,
- cachable, reqtime, frev);
- }
- }
- }
*mrp = mrep;
*mdp = md;
*dposp = dpos;
@@ -1189,13 +1162,8 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp)
case EPROGMISMATCH:
*tl = txdr_unsigned(RPC_PROGMISMATCH);
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
- if (nd->nd_flag & ND_NQNFS) {
- *tl++ = txdr_unsigned(3);
- *tl = txdr_unsigned(3);
- } else {
- *tl++ = txdr_unsigned(2);
- *tl = txdr_unsigned(3);
- }
+ *tl++ = txdr_unsigned(2);
+ *tl = txdr_unsigned(3);
break;
case EPROCUNAVAIL:
*tl = txdr_unsigned(RPC_PROCUNAVAIL);
@@ -1216,21 +1184,6 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp)
};
}
- /*
- * For nqnfs, piggyback lease as requested.
- */
- if ((nd->nd_flag & ND_NQNFS) && err == 0) {
- if (nd->nd_flag & ND_LEASE) {
- nfsm_build(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
- *tl++ = txdr_unsigned(nd->nd_flag & ND_LEASE);
- *tl++ = txdr_unsigned(cache);
- *tl++ = txdr_unsigned(nd->nd_duration);
- txdr_hyper(*frev, tl);
- } else {
- nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
- *tl = 0;
- }
- }
*mrq = mreq;
if (mrq != NULL)
*mbp = mb;
@@ -1259,7 +1212,6 @@ nfs_timer(arg)
int s, error;
#ifdef NFSSERVER
struct nfssvc_sock *slp;
- static long lasttime = 0;
u_quad_t cur_usec;
#endif
@@ -1353,14 +1305,6 @@ nfs_timer(arg)
#ifdef NFSSERVER
/*
- * Call the nqnfs server timer once a second to handle leases.
- */
- if (lasttime != time.tv_sec) {
- lasttime = time.tv_sec;
- nqnfs_serverd();
- }
-
- /*
* Scan the write gathering queues for writes that need to be
* completed now.
*/
@@ -1603,7 +1547,7 @@ nfs_getreq(nd, nfsd, has_header)
caddr_t dpos, cp2, cp;
u_int32_t nfsvers, auth_type;
uid_t nickuid;
- int error = 0, nqnfs = 0, ticklen;
+ int error = 0, ticklen;
struct mbuf *mrep, *md;
register struct nfsuid *nuidp;
struct timeval tvin, tvout;
@@ -1628,31 +1572,24 @@ nfs_getreq(nd, nfsd, has_header)
return (0);
}
if (*tl != nfs_prog) {
- if (*tl == nqnfs_prog)
- nqnfs++;
- else {
- nd->nd_repstat = EPROGUNAVAIL;
- nd->nd_procnum = NFSPROC_NOOP;
- return (0);
- }
+ nd->nd_repstat = EPROGUNAVAIL;
+ nd->nd_procnum = NFSPROC_NOOP;
+ return (0);
}
tl++;
nfsvers = fxdr_unsigned(u_int32_t, *tl++);
- if (((nfsvers < NFS_VER2 || nfsvers > NFS_VER3) && !nqnfs) ||
- (nfsvers != NQNFS_VER3 && nqnfs)) {
+ if (nfsvers != NFS_VER2 && nfsvers != NFS_VER3) {
nd->nd_repstat = EPROGMISMATCH;
nd->nd_procnum = NFSPROC_NOOP;
return (0);
}
- if (nqnfs)
- nd->nd_flag = (ND_NFSV3 | ND_NQNFS);
- else if (nfsvers == NFS_VER3)
+ if (nfsvers == NFS_VER3)
nd->nd_flag = ND_NFSV3;
nd->nd_procnum = fxdr_unsigned(u_int32_t, *tl++);
if (nd->nd_procnum == NFSPROC_NULL)
return (0);
if (nd->nd_procnum >= NFS_NPROCS ||
- (!nqnfs && nd->nd_procnum >= NQNFSPROC_GETLEASE) ||
+ (nd->nd_procnum > NFSPROC_COMMIT) ||
(!nd->nd_flag && nd->nd_procnum > NFSV2PROC_STATFS)) {
nd->nd_repstat = EPROCUNAVAIL;
nd->nd_procnum = NFSPROC_NOOP;
@@ -1808,19 +1745,6 @@ nfs_getreq(nd, nfsd, has_header)
return (0);
}
- /*
- * For nqnfs, get piggybacked lease request.
- */
- if (nqnfs && nd->nd_procnum != NQNFSPROC_EVICTED) {
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
- nd->nd_flag |= fxdr_unsigned(int, *tl);
- if (nd->nd_flag & ND_LEASE) {
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
- nd->nd_duration = fxdr_unsigned(u_int32_t, *tl);
- } else
- nd->nd_duration = NQ_MINLEASE;
- } else
- nd->nd_duration = NQ_MINLEASE;
nd->nd_md = md;
nd->nd_dpos = dpos;
return (0);
@@ -1870,8 +1794,8 @@ int (*nfsrv3_procs[NFS_NPROCS]) __P((struct nfsrv_descript *,
nfsrv_fsinfo,
nfsrv_pathconf,
nfsrv_commit,
- nqnfsrv_getlease,
- nqnfsrv_vacated,
+ nfsrv_noop,
+ nfsrv_noop,
nfsrv_noop,
nfsrv_noop
};
diff --git a/sys/nfs/nfs_srvcache.c b/sys/nfs/nfs_srvcache.c
index a167ae4f300..8aaa06382cc 100644
--- a/sys/nfs/nfs_srvcache.c
+++ b/sys/nfs/nfs_srvcache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_srvcache.c,v 1.6 1999/04/28 09:28:17 art Exp $ */
+/* $OpenBSD: nfs_srvcache.c,v 1.7 2001/06/25 03:28:09 csapuntz Exp $ */
/* $NetBSD: nfs_srvcache.c,v 1.12 1996/02/18 11:53:49 fvdl Exp $ */
/*
@@ -64,7 +64,6 @@
#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
#include <nfs/nfsrvcache.h>
-#include <nfs/nqnfs.h>
#include <nfs/nfs_var.h>
extern struct nfsstats nfsstats;
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 2d27874e8b9..539c7c00132 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.30 2001/06/25 02:15:47 csapuntz Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.31 2001/06/25 03:28:10 csapuntz Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */
/*
@@ -68,7 +68,6 @@
#include <nfs/xdr_subs.h>
#include <nfs/nfsm_subs.h>
#include <nfs/nfsmount.h>
-#include <nfs/nqnfs.h>
#include <nfs/nfsrtt.h>
#include <nfs/nfs_var.h>
@@ -99,7 +98,7 @@ u_int32_t nfs_xdrneg1;
u_int32_t rpc_call, rpc_vers, rpc_reply, rpc_msgdenied, rpc_autherr,
rpc_mismatch, rpc_auth_unix, rpc_msgaccepted,
rpc_auth_kerb;
-u_int32_t nfs_prog, nqnfs_prog, nfs_true, nfs_false;
+u_int32_t nfs_prog, nfs_true, nfs_false;
/* And other global data */
static u_int32_t nfs_xid = 0;
@@ -535,12 +534,7 @@ static short *nfsrv_v3errmap[] = {
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
extern struct nfsrtt nfsrtt;
-extern time_t nqnfsstarttime;
-extern int nqsrv_clockskew;
-extern int nqsrv_writeslack;
-extern int nqsrv_maxlease;
extern struct nfsstats nfsstats;
-extern int nqnfs_piggy[NFS_NPROCS];
extern nfstype nfsv2_type[9];
extern nfstype nfsv3_type[9];
extern struct nfsnodehashhead *nfsnodehashtbl;
@@ -561,11 +555,7 @@ nfsm_reqh(vp, procid, hsiz, bposp)
caddr_t *bposp;
{
register struct mbuf *mb;
- register u_int32_t *tl;
register caddr_t bpos;
- struct mbuf *mb2;
- struct nfsmount *nmp;
- int nqflag;
MGET(mb, M_WAIT, MT_DATA);
if (hsiz >= MINCLSIZE)
@@ -573,23 +563,6 @@ nfsm_reqh(vp, procid, hsiz, bposp)
mb->m_len = 0;
bpos = mtod(mb, caddr_t);
- /*
- * For NQNFS, add lease request.
- */
- if (vp) {
- nmp = VFSTONFS(vp->v_mount);
- if (nmp->nm_flag & NFSMNT_NQNFS) {
- nqflag = NQNFS_NEEDLEASE(vp, procid);
- if (nqflag) {
- nfsm_build(tl, u_int32_t *, 2*NFSX_UNSIGNED);
- *tl++ = txdr_unsigned(nqflag);
- *tl = txdr_unsigned(nmp->nm_leaseterm);
- } else {
- nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED);
- *tl = 0;
- }
- }
- }
/* Finally, return values */
*bposp = bpos;
return (mb);
@@ -656,16 +629,11 @@ nfsm_rpchead(cr, nmflag, procid, auth_type, auth_len, auth_str, verf_len,
*tl++ = *xidp = txdr_unsigned(nfs_xid);
*tl++ = rpc_call;
*tl++ = rpc_vers;
- if (nmflag & NFSMNT_NQNFS) {
- *tl++ = txdr_unsigned(NQNFS_PROG);
- *tl++ = txdr_unsigned(NQNFS_VER3);
- } else {
- *tl++ = txdr_unsigned(NFS_PROG);
- if (nmflag & NFSMNT_NFSV3)
- *tl++ = txdr_unsigned(NFS_VER3);
- else
- *tl++ = txdr_unsigned(NFS_VER2);
- }
+ *tl++ = txdr_unsigned(NFS_PROG);
+ if (nmflag & NFSMNT_NFSV3)
+ *tl++ = txdr_unsigned(NFS_VER3);
+ else
+ *tl++ = txdr_unsigned(NFS_VER2);
if (nmflag & NFSMNT_NFSV3)
*tl++ = txdr_unsigned(procid);
else
@@ -1115,7 +1083,6 @@ nfs_init()
rpc_auth_unix = txdr_unsigned(RPCAUTH_UNIX);
rpc_auth_kerb = txdr_unsigned(RPCAUTH_KERB4);
nfs_prog = txdr_unsigned(NFS_PROG);
- nqnfs_prog = txdr_unsigned(NQNFS_PROG);
nfs_true = txdr_unsigned(TRUE);
nfs_false = txdr_unsigned(FALSE);
nfs_xdrneg1 = txdr_unsigned(-1);
@@ -1128,17 +1095,6 @@ nfs_init()
#endif /* NFSSERVER */
/*
- * Initialize the nqnfs client/server stuff.
- */
- if (nqnfsstarttime == 0) {
- nqnfsstarttime = boottime.tv_sec + nqsrv_maxlease
- + nqsrv_clockskew + nqsrv_writeslack;
- NQLOADNOVRAM(nqnfsstarttime);
- CIRCLEQ_INIT(&nqtimerhead);
- nqfhhashtbl = hashinit(NQLCHSZ, M_NQLEASE, M_WAITOK, &nqfhhash);
- }
-
- /*
* Initialize reply list and start timer
*/
TAILQ_INIT(&nfs_reqq);
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 6463d1ce197..6b093d60b39 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_syscalls.c,v 1.17 2001/02/23 14:52:51 csapuntz Exp $ */
+/* $OpenBSD: nfs_syscalls.c,v 1.18 2001/06/25 03:28:11 csapuntz Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */
/*
@@ -76,7 +76,6 @@
#include <nfs/nfsrvcache.h>
#include <nfs/nfsmount.h>
#include <nfs/nfsnode.h>
-#include <nfs/nqnfs.h>
#include <nfs/nfsrtt.h>
#include <nfs/nfs_var.h>
@@ -88,8 +87,6 @@ extern int32_t (*nfsrv3_procs[NFS_NPROCS]) __P((struct nfsrv_descript *,
struct proc *, struct mbuf **));
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
extern int nfs_numasync;
-extern time_t nqnfsstarttime;
-extern int nqsrv_writeslack;
extern int nfsrtton;
extern struct nfsstats nfsstats;
extern int nfsrvw_procrastinate;
@@ -99,7 +96,6 @@ int nfsd_waiting = 0;
#ifdef NFSSERVER
static int nfs_numnfsd = 0;
static int notstarted = 1;
-static int modify_flag = 0;
static struct nfsdrt nfsdrt;
#endif
@@ -115,6 +111,97 @@ int nfs_niothreads = -1;
static void nfsd_rt __P((int, struct nfsrv_descript *, int));
#endif
+int nfs_clientd(struct nfsmount *nmp, struct ucred *cred,
+ struct nfsd_cargs *ncd, int flag, caddr_t argp, struct proc *p);
+
+/*
+ * Nfs client helper daemon.
+ * It also get authorization strings for "kerb" mounts.
+ * It must start at the beginning of the list again after any potential
+ * "sleep" since nfs_reclaim() called from vclean() can pull a node off
+ * the list asynchronously.
+ */
+int
+nfs_clientd(struct nfsmount *nmp, struct ucred *cred, struct nfsd_cargs *ncd,
+ int flag, caddr_t argp, struct proc *p)
+{
+ struct nfsuid *nuidp, *nnuidp;
+ int error = 0;
+
+ /*
+ * First initialize some variables
+ */
+
+ /*
+ * If an authorization string is being passed in, get it.
+ */
+ if ((flag & NFSSVC_GOTAUTH) &&
+ (nmp->nm_flag & (NFSMNT_WAITAUTH | NFSMNT_DISMNT)) == 0) {
+ if (nmp->nm_flag & NFSMNT_HASAUTH)
+ panic("cld kerb");
+ if ((flag & NFSSVC_AUTHINFAIL) == 0) {
+ if (ncd->ncd_authlen <= nmp->nm_authlen &&
+ ncd->ncd_verflen <= nmp->nm_verflen &&
+ !copyin(ncd->ncd_authstr,nmp->nm_authstr,ncd->ncd_authlen)&&
+ !copyin(ncd->ncd_verfstr,nmp->nm_verfstr,ncd->ncd_verflen)){
+ nmp->nm_authtype = ncd->ncd_authtype;
+ nmp->nm_authlen = ncd->ncd_authlen;
+ nmp->nm_verflen = ncd->ncd_verflen;
+#ifdef NFSKERB
+ nmp->nm_key = ncd->ncd_key;
+#endif
+ } else
+ nmp->nm_flag |= NFSMNT_AUTHERR;
+ } else
+ nmp->nm_flag |= NFSMNT_AUTHERR;
+ nmp->nm_flag |= NFSMNT_HASAUTH;
+ wakeup((caddr_t)&nmp->nm_authlen);
+ } else
+ nmp->nm_flag |= NFSMNT_WAITAUTH;
+
+ /*
+ * Loop every second updating queue until there is a termination sig.
+ */
+ while ((nmp->nm_flag & NFSMNT_DISMNT) == 0) {
+ /*
+ * Get an authorization string, if required.
+ */
+ if ((nmp->nm_flag & (NFSMNT_WAITAUTH | NFSMNT_DISMNT | NFSMNT_HASAUTH)) == 0) {
+ ncd->ncd_authuid = nmp->nm_authuid;
+ if (copyout((caddr_t)ncd, argp, sizeof (struct nfsd_cargs)))
+ nmp->nm_flag |= NFSMNT_WAITAUTH;
+ else
+ return (ENEEDAUTH);
+ }
+
+ /*
+ * Wait a bit (no pun) and do it again.
+ */
+ if ((nmp->nm_flag & NFSMNT_DISMNT) == 0 &&
+ (nmp->nm_flag & (NFSMNT_WAITAUTH | NFSMNT_HASAUTH))) {
+ error = tsleep((caddr_t)&nmp->nm_authstr, PSOCK | PCATCH,
+ "nqnfstimr", hz / 3);
+ if (error == EINTR || error == ERESTART)
+ (void) dounmount(nmp->nm_mountp, MNT_FORCE, p);
+ }
+ }
+
+ /*
+ * Finally, we can free up the mount structure.
+ */
+ for (nuidp = nmp->nm_uidlruhead.tqh_first; nuidp != 0; nuidp = nnuidp) {
+ nnuidp = nuidp->nu_lru.tqe_next;
+ LIST_REMOVE(nuidp, nu_hash);
+ TAILQ_REMOVE(&nmp->nm_uidlruhead, nuidp, nu_lru);
+ free((caddr_t)nuidp, M_NFSUID);
+ }
+ free((caddr_t)nmp, M_NFSMNT);
+ if (error == EWOULDBLOCK)
+ error = 0;
+ return (error);
+}
+
+
/*
* NFS server system calls
*/
@@ -186,7 +273,7 @@ sys_nfssvc(p, v, retval)
(SCARG(uap, flag) & NFSSVC_GOTAUTH) == 0)
return (0);
nmp->nm_flag |= NFSMNT_MNTD;
- error = nqnfs_clientd(nmp, p->p_ucred, &ncd, SCARG(uap, flag),
+ error = nfs_clientd(nmp, p->p_ucred, &ncd, SCARG(uap, flag),
SCARG(uap, argp), p);
#endif /* NFSCLIENT */
} else if (SCARG(uap, flag) & NFSSVC_ADDSOCK) {
@@ -545,31 +632,13 @@ nfssvc_nfsd(nsd, argp, p)
} else
cacherep = nfsrv_getcache(nd, slp, &mreq);
- /*
- * Check for just starting up for NQNFS and send
- * fake "try again later" replies to the NQNFS clients.
- */
- if (notstarted && nqnfsstarttime <= time.tv_sec) {
- if (modify_flag) {
- nqnfsstarttime = time.tv_sec + nqsrv_writeslack;
- modify_flag = 0;
- } else
- notstarted = 0;
- }
if (notstarted) {
- if ((nd->nd_flag & ND_NQNFS) == 0)
- cacherep = RC_DROPIT;
- else if (nd->nd_procnum != NFSPROC_WRITE) {
- nd->nd_procnum = NFSPROC_NOOP;
- nd->nd_repstat = NQNFS_TRYLATER;
- cacherep = RC_DOIT;
- } else
- modify_flag = 1;
+ cacherep = RC_DROPIT;
} else if (nfsd->nfsd_flag & NFSD_AUTHFAIL) {
- nfsd->nfsd_flag &= ~NFSD_AUTHFAIL;
- nd->nd_procnum = NFSPROC_NOOP;
- nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK);
- cacherep = RC_DOIT;
+ nfsd->nfsd_flag &= ~NFSD_AUTHFAIL;
+ nd->nd_procnum = NFSPROC_NOOP;
+ nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK);
+ cacherep = RC_DOIT;
}
}
@@ -590,8 +659,7 @@ nfssvc_nfsd(nsd, argp, p)
if (mreq == NULL)
break;
if (error) {
- if (nd->nd_procnum != NQNFSPROC_VACATED)
- nfsstats.srv_errs++;
+ nfsstats.srv_errs++;
nfsrv_updatecache(nd, FALSE, mreq);
if (nd->nd_nam2)
m_freem(nd->nd_nam2);
@@ -824,8 +892,6 @@ nfsd_rt(sotype, nd, cacherep)
rt->flag = DRT_CACHEDROP;
if (sotype == SOCK_STREAM)
rt->flag |= DRT_TCP;
- if (nd->nd_flag & ND_NQNFS)
- rt->flag |= DRT_NQNFS;
else if (nd->nd_flag & ND_NFSV3)
rt->flag |= DRT_NFSV3;
rt->proc = nd->nd_procnum;
diff --git a/sys/nfs/nfs_var.h b/sys/nfs/nfs_var.h
index 3e8c5118cfd..6010cdc1a57 100644
--- a/sys/nfs/nfs_var.h
+++ b/sys/nfs/nfs_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_var.h,v 1.13 2001/06/25 02:15:47 csapuntz Exp $ */
+/* $OpenBSD: nfs_var.h,v 1.14 2001/06/25 03:28:12 csapuntz Exp $ */
/* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */
/*
@@ -46,8 +46,6 @@ struct vnode;
struct nfsd;
struct mbuf;
struct file;
-struct nqlease;
-struct nqhost;
struct nfssvc_sock;
struct nfsmount;
struct socket;
@@ -147,33 +145,6 @@ int nfsfifo_read __P((void *));
int nfsfifo_write __P((void *));
int nfsfifo_close __P((void *));
-/* nfs_nqlease.c */
-void nqnfs_lease_updatetime __P((int));
-void nqnfs_clientlease __P((struct nfsmount *, struct nfsnode *, int, int,
- time_t, u_quad_t));
-void nqsrv_locklease __P((struct nqlease *));
-void nqsrv_unlocklease __P((struct nqlease *));
-int nqsrv_getlease __P((struct vnode *, u_int32_t *, int, struct nfssvc_sock *,
- struct proc *, struct mbuf *, int *, u_quad_t *,
- struct ucred *));
-int nqnfs_vop_lease_check __P((void *));
-void nqsrv_addhost __P((struct nqhost *, struct nfssvc_sock *, struct mbuf *));
-void nqsrv_instimeq __P((struct nqlease *, u_int32_t));
-int nqsrv_cmpnam __P((struct nfssvc_sock *, struct mbuf *, struct nqhost *));
-void nqsrv_send_eviction __P((struct vnode *, struct nqlease *,
- struct nfssvc_sock *, struct mbuf *,
- struct ucred *));
-void nqsrv_waitfor_expiry __P((struct nqlease *));
-void nqnfs_serverd __P((void));
-int nqnfsrv_getlease __P((struct nfsrv_descript *, struct nfssvc_sock *,
- struct proc *, struct mbuf **));
-int nqnfsrv_vacated __P((struct nfsrv_descript *, struct nfssvc_sock *,
- struct proc *, struct mbuf **));
-int nqnfs_getlease __P((struct vnode *, int, struct ucred *, struct proc *));
-int nqnfs_vacated __P((struct vnode *, struct ucred *));
-int nqnfs_callback __P((struct nfsmount *, struct mbuf *, struct mbuf *,
- caddr_t));
-
/* nfs_serv.c */
int nfsrv3_access __P((struct nfsrv_descript *, struct nfssvc_sock *,
struct proc *, struct mbuf **));
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index 2acd4ae262c..70c696ed0a3 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.34 2001/06/24 21:16:20 csapuntz Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.35 2001/06/25 03:28:12 csapuntz Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
@@ -67,9 +67,11 @@
#include <nfs/xdr_subs.h>
#include <nfs/nfsm_subs.h>
#include <nfs/nfsdiskless.h>
-#include <nfs/nqnfs.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;
@@ -522,13 +524,9 @@ 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_LEASETERM) && argp->leaseterm >= 2 &&
- argp->leaseterm <= NQ_MAXLEASE)
- nmp->nm_leaseterm = argp->leaseterm;
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;
@@ -577,7 +575,6 @@ nfs_decode_args(nmp, argp, nargp)
nargp->retrans = nmp->nm_retry;
nargp->maxgrouplist = nmp->nm_numgrps;
nargp->readahead = nmp->nm_readahead;
- nargp->leaseterm = nmp->nm_leaseterm;
nargp->deadthresh = nmp->nm_deadthresh;
nargp->acregmin = nmp->nm_acregmin;
nargp->acregmax = nmp->nm_acregmax;
@@ -640,10 +637,10 @@ nfs_mount(mp, path, data, ndp, p)
return (EIO);
/*
* When doing an update, we can't change from or to
- * v3 and/or nqnfs.
+ * v3.
*/
- args.flags = (args.flags & ~(NFSMNT_NFSV3|NFSMNT_NQNFS)) |
- (nmp->nm_flag & (NFSMNT_NFSV3|NFSMNT_NQNFS));
+ args.flags = (args.flags & ~(NFSMNT_NFSV3)) |
+ (nmp->nm_flag & (NFSMNT_NFSV3));
nfs_decode_args(nmp, &args, &mp->mnt_stat.mount_info.nfs_args);
return (0);
}
@@ -696,14 +693,6 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
vfs_getnewfsid(mp);
nmp->nm_mountp = mp;
- if (argp->flags & NFSMNT_NQNFS)
- /*
- * We have to set mnt_maxsymlink to a non-zero value so
- * that COMPAT_43 routines will know that we are setting
- * the d_type field in directories (and can zero it for
- * unsuspecting binaries).
- */
- mp->mnt_maxsymlinklen = 1;
nmp->nm_timeo = NFS_TIMEO;
nmp->nm_retry = NFS_RETRANS;
nmp->nm_wsize = NFS_WSIZE;
@@ -711,7 +700,6 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
nmp->nm_readdirsize = NFS_READDIRSIZE;
nmp->nm_numgrps = NFS_MAXGRPS;
nmp->nm_readahead = NFS_DEFRAHEAD;
- nmp->nm_leaseterm = NQ_DEFLEASE;
nmp->nm_deadthresh = NQ_DEADTHRESH;
CIRCLEQ_INIT(&nmp->nm_timerhead);
nmp->nm_inprog = NULLVP;
@@ -795,13 +783,13 @@ nfs_unmount(mp, mntflags, p)
* We are now committed to the unmount.
* For NQNFS, let the server daemon free the nfsmount structure.
*/
- if (nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_KERB))
+ if (nmp->nm_flag & NFSMNT_KERB)
nmp->nm_flag |= NFSMNT_DISMNT;
nfs_disconnect(nmp);
m_freem(nmp->nm_nam);
- if ((nmp->nm_flag & (NFSMNT_NQNFS | NFSMNT_KERB)) == 0)
+ if ((nmp->nm_flag & NFSMNT_KERB) == 0)
free((caddr_t)nmp, M_NFSMNT);
return (0);
}
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 131463b45c2..db4bf0c2e40 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.32 2001/06/25 02:15:48 csapuntz Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.33 2001/06/25 03:28:13 csapuntz Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -73,7 +73,6 @@
#include <nfs/nfsmount.h>
#include <nfs/xdr_subs.h>
#include <nfs/nfsm_subs.h>
-#include <nfs/nqnfs.h>
#include <nfs/nfs_var.h>
#include <net/if.h>
@@ -364,7 +363,6 @@ nfs_open(v)
} */ *ap = v;
register struct vnode *vp = ap->a_vp;
struct nfsnode *np = VTONFS(vp);
- struct nfsmount *nmp = VFSTONFS(vp->v_mount);
struct vattr vattr;
int error;
@@ -374,68 +372,42 @@ nfs_open(v)
#endif
return (EACCES);
}
- /*
- * Get a valid lease. If cached data is stale, flush it.
- */
- if (nmp->nm_flag & NFSMNT_NQNFS) {
- if (NQNFS_CKINVALID(vp, np, ND_READ)) {
- do {
- error = nqnfs_getlease(vp, ND_READ, ap->a_cred,
- ap->a_p);
- } while (error == NQNFS_EXPIRED);
- if (error)
+
+ if (np->n_flag & NMODIFIED) {
+ if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
+ ap->a_p, 1)) == EINTR)
return (error);
- if (np->n_lrev != np->n_brev ||
- (np->n_flag & NQNFSNONCACHE)) {
- if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
- ap->a_p, 1)) == EINTR)
- return (error);
#if defined(UVM)
- uvm_vnp_uncache(vp);
+ uvm_vnp_uncache(vp);
#else
- (void) vnode_pager_uncache(vp);
+ (void) vnode_pager_uncache(vp);
#endif
- np->n_brev = np->n_lrev;
- }
- }
+ np->n_attrstamp = 0;
+ if (vp->v_type == VDIR)
+ np->n_direofoffset = 0;
+ error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);
+ if (error)
+ return (error);
+ np->n_mtime = vattr.va_mtime.tv_sec;
} else {
- if (np->n_flag & NMODIFIED) {
- if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
- ap->a_p, 1)) == EINTR)
+ error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);
+ if (error)
+ return (error);
+ if (np->n_mtime != vattr.va_mtime.tv_sec) {
+ if (vp->v_type == VDIR)
+ np->n_direofoffset = 0;
+ if ((error = nfs_vinvalbuf(vp, V_SAVE,
+ ap->a_cred, ap->a_p, 1)) == EINTR)
return (error);
#if defined(UVM)
uvm_vnp_uncache(vp);
#else
(void) vnode_pager_uncache(vp);
#endif
- np->n_attrstamp = 0;
- if (vp->v_type == VDIR)
- np->n_direofoffset = 0;
- error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);
- if (error)
- return (error);
np->n_mtime = vattr.va_mtime.tv_sec;
- } else {
- error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);
- if (error)
- return (error);
- if (np->n_mtime != vattr.va_mtime.tv_sec) {
- if (vp->v_type == VDIR)
- np->n_direofoffset = 0;
- if ((error = nfs_vinvalbuf(vp, V_SAVE,
- ap->a_cred, ap->a_p, 1)) == EINTR)
- return (error);
-#if defined(UVM)
- uvm_vnp_uncache(vp);
-#else
- (void) vnode_pager_uncache(vp);
-#endif
- np->n_mtime = vattr.va_mtime.tv_sec;
- }
}
}
- if ((nmp->nm_flag & NFSMNT_NQNFS) == 0)
- np->n_attrstamp = 0; /* For Open/Close consistency */
+ np->n_attrstamp = 0; /* For Open/Close consistency */
return (0);
}
@@ -465,9 +437,6 @@ nfs_open(v)
* enough". Changing the last argument to nfs_flush() to
* a 1 would force a commit operation, if it is felt a
* commit is necessary now.
- * for NQNFS - do nothing now, since 2 is dealt with via leases and
- * 1 should be dealt with via an fsync() system call for
- * cases where write errors are important.
*/
/* ARGSUSED */
int
@@ -486,8 +455,7 @@ nfs_close(v)
int error = 0;
if (vp->v_type == VREG) {
- if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS) == 0 &&
- (np->n_flag & NMODIFIED)) {
+ if (np->n_flag & NMODIFIED) {
if (NFS_ISV3(vp)) {
error = nfs_flush(vp, ap->a_cred, MNT_WAIT, ap->a_p, 0);
np->n_flag &= ~NMODIFIED;
@@ -1890,17 +1858,9 @@ nfs_readdir(v)
* First, check for hit on the EOF offset cache
*/
if (np->n_direofoffset != 0 &&
- uio->uio_offset == np->n_direofoffset &&
- (np->n_flag & NMODIFIED) == 0) {
- if (VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS) {
- if (NQNFS_CKCACHABLE(vp, ND_READ)) {
- nfsstats.direofcache_hits++;
- *ap->a_eofflag = 1;
- return (0);
- }
- } else if (
- VOP_GETATTR(vp, &vattr, ap->a_cred, uio->uio_procp) == 0 &&
- np->n_mtime == vattr.va_mtime.tv_sec) {
+ uio->uio_offset == np->n_direofoffset) {
+ if (VOP_GETATTR(vp, &vattr, ap->a_cred, uio->uio_procp) == 0 &&
+ np->n_mtime == vattr.va_mtime.tv_sec) {
nfsstats.direofcache_hits++;
*ap->a_eofflag = 1;
return (0);
diff --git a/sys/nfs/nfsmount.h b/sys/nfs/nfsmount.h
index 6713c6a9f6f..0ac86539173 100644
--- a/sys/nfs/nfsmount.h
+++ b/sys/nfs/nfsmount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsmount.h,v 1.8 2001/02/20 01:50:11 assar Exp $ */
+/* $OpenBSD: nfsmount.h,v 1.9 2001/06/25 03:28:14 csapuntz Exp $ */
/* $NetBSD: nfsmount.h,v 1.10 1996/02/18 11:54:03 fvdl Exp $ */
/*
@@ -71,7 +71,6 @@ struct nfsmount {
int nm_wsize; /* Max size of write rpc */
int nm_readdirsize; /* Size of a readdir rpc */
int nm_readahead; /* Num. of blocks to readahead */
- int nm_leaseterm; /* Term (sec) for NQNFS lease */
CIRCLEQ_HEAD(, nfsnode) nm_timerhead; /* Head of lease timer queue */
struct vnode *nm_inprog; /* Vnode in prog by nqnfs_clientd() */
uid_t nm_authuid; /* Uid for authenticator */
diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h
index 27f33ffb8e8..02b8c8cbd31 100644
--- a/sys/nfs/nfsnode.h
+++ b/sys/nfs/nfsnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsnode.h,v 1.9 2001/06/25 02:15:48 csapuntz Exp $ */
+/* $OpenBSD: nfsnode.h,v 1.10 2001/06/25 03:28:14 csapuntz Exp $ */
/* $NetBSD: nfsnode.h,v 1.16 1996/02/18 11:54:04 fvdl Exp $ */
/*
@@ -133,9 +133,6 @@ struct nfsnode {
#define NFLUSHINPROG 0x0002 /* Avoid multiple calls to vinvalbuf() */
#define NMODIFIED 0x0004 /* Might have a modified buffer in bio */
#define NWRITEERR 0x0008 /* Flag write errors so close will know */
-#define NQNFSNONCACHE 0x0020 /* Non-cachable lease */
-#define NQNFSWRITE 0x0040 /* Write lease */
-#define NQNFSEVICTED 0x0080 /* Has been evicted */
#define NACC 0x0100 /* Special file accessed */
#define NUPD 0x0200 /* Special file updated */
#define NCHG 0x0400 /* Special file times changed */
diff --git a/sys/nfs/nfsproto.h b/sys/nfs/nfsproto.h
index 2c22258ff93..64a2b618d19 100644
--- a/sys/nfs/nfsproto.h
+++ b/sys/nfs/nfsproto.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsproto.h,v 1.2 1996/04/17 04:50:39 mickey Exp $ */
+/* $OpenBSD: nfsproto.h,v 1.3 2001/06/25 03:28:15 csapuntz Exp $ */
/* $NetBSD: nfsproto.h,v 1.1 1996/02/18 11:54:06 fvdl Exp $ */
/*
@@ -173,11 +173,6 @@
#define NFSPROC_PATHCONF 20
#define NFSPROC_COMMIT 21
-/* And leasing (nqnfs) procedure numbers (must be last) */
-#define NQNFSPROC_GETLEASE 22
-#define NQNFSPROC_VACATED 23
-#define NQNFSPROC_EVICTED 24
-
#define NFSPROC_NOOP 25
#define NFS_NPROCS 26
diff --git a/sys/nfs/nfsrtt.h b/sys/nfs/nfsrtt.h
index 4d368d7307c..f6587c325c5 100644
--- a/sys/nfs/nfsrtt.h
+++ b/sys/nfs/nfsrtt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsrtt.h,v 1.4 1996/04/17 04:50:39 mickey Exp $ */
+/* $OpenBSD: nfsrtt.h,v 1.5 2001/06/25 03:28:15 csapuntz Exp $ */
/* $NetBSD: nfsrtt.h,v 1.4 1996/02/18 11:54:07 fvdl Exp $ */
/*
@@ -81,7 +81,6 @@ struct nfsrtt {
/*
* Bits for the flags field.
*/
-#define DRT_NQNFS 0x01 /* Rpc used Nqnfs protocol */
#define DRT_TCP 0x02 /* Client used TCP transport */
#define DRT_CACHEREPLY 0x04 /* Reply was from recent request cache */
#define DRT_CACHEDROP 0x08 /* Rpc request dropped, due to recent reply */
diff --git a/sys/nfs/nfsrvcache.h b/sys/nfs/nfsrvcache.h
index 29241af6635..e64aad63f07 100644
--- a/sys/nfs/nfsrvcache.h
+++ b/sys/nfs/nfsrvcache.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsrvcache.h,v 1.4 1996/04/17 04:50:40 mickey Exp $ */
+/* $OpenBSD: nfsrvcache.h,v 1.5 2001/06/25 03:28:16 csapuntz Exp $ */
/* $NetBSD: nfsrvcache.h,v 1.10 1996/02/18 11:54:08 fvdl Exp $ */
/*
@@ -84,7 +84,6 @@ struct nfsrvcache {
#define RC_WANTED 0x02
#define RC_REPSTATUS 0x04
#define RC_REPMBUF 0x08
-#define RC_NQNFS 0x10
#define RC_INETADDR 0x20
#define RC_NAM 0x40
diff --git a/sys/nfs/nqnfs.h b/sys/nfs/nqnfs.h
deleted file mode 100644
index 4764c32bcd2..00000000000
--- a/sys/nfs/nqnfs.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $OpenBSD: nqnfs.h,v 1.4 1996/04/17 04:50:42 mickey Exp $ */
-/* $NetBSD: nqnfs.h,v 1.6 1996/02/18 11:54:10 fvdl Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Rick Macklem at The University of Guelph.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)nqnfs.h 8.3 (Berkeley) 3/30/95
- */
-
-
-#ifndef _NFS_NQNFS_H_
-#define _NFS_NQNFS_H_
-
-/*
- * Definitions for NQNFS (Not Quite NFS) cache consistency protocol.
- */
-
-/* Tunable constants */
-#define NQ_CLOCKSKEW 3 /* Clock skew factor (sec) */
-#define NQ_WRITESLACK 5 /* Delay for write cache flushing */
-#define NQ_MAXLEASE 60 /* Max lease duration (sec) */
-#define NQ_MINLEASE 5 /* Min lease duration (sec) */
-#define NQ_DEFLEASE 30 /* Default lease duration (sec) */
-#define NQ_RENEWAL 3 /* Time before expiry (sec) to renew */
-#define NQ_TRYLATERDEL 15 /* Initial try later delay (sec) */
-#define NQ_MAXNUMLEASE 2048 /* Upper bound on number of server leases */
-#define NQ_DEADTHRESH NQ_NEVERDEAD /* Default nm_deadthresh */
-#define NQ_NEVERDEAD 9 /* Greater than max. nm_timeouts */
-#define NQLCHSZ 256 /* Server hash table size */
-
-#define NQNFS_PROG 300105 /* As assigned by Sun */
-#define NQNFS_VER3 3
-#define NQNFS_EVICTSIZ 156 /* Size of eviction request in bytes */
-
-/*
- * Definitions used for saving the "last lease expires" time in Non-volatile
- * RAM on the server. The default definitions below assume that NOVRAM is not
- * available.
- */
-#ifdef HASNVRAM
-# undef HASNVRAM
-#endif
-#define NQSTORENOVRAM(t)
-#define NQLOADNOVRAM(t)
-
-/*
- * Defn and structs used on the server to maintain state for current leases.
- * The list of host(s) that hold the lease are kept as nqhost structures.
- * The first one lives in nqlease and any others are held in a linked
- * list of nqm structures hanging off of nqlease.
- *
- * Each nqlease structure is chained into two lists. The first is a list
- * ordered by increasing expiry time for nqsrv_timer() and the second is a chain
- * hashed on lc_fh.
- */
-#define LC_MOREHOSTSIZ 10
-
-struct nqhost {
- union {
- struct {
- u_int16_t udp_flag;
- u_int16_t udp_port;
- union nethostaddr udp_haddr;
- } un_udp;
- struct {
- u_int16_t connless_flag;
- u_int16_t connless_spare;
- union nethostaddr connless_haddr;
- } un_connless;
- struct {
- u_int16_t conn_flag;
- u_int16_t conn_spare;
- struct nfssvc_sock *conn_slp;
- } un_conn;
- } lph_un;
-};
-#define lph_flag lph_un.un_udp.udp_flag
-#define lph_port lph_un.un_udp.udp_port
-#define lph_haddr lph_un.un_udp.udp_haddr
-#define lph_inetaddr lph_un.un_udp.udp_haddr.had_inetaddr
-#define lph_claddr lph_un.un_connless.connless_haddr
-#define lph_nam lph_un.un_connless.connless_haddr.had_nam
-#define lph_slp lph_un.un_conn.conn_slp
-
-struct nqlease {
- LIST_ENTRY(nqlease) lc_hash; /* Fhandle hash list */
- CIRCLEQ_ENTRY(nqlease) lc_timer; /* Timer queue list */
- time_t lc_expiry; /* Expiry time (sec) */
- struct nqhost lc_host; /* Host that got lease */
- struct nqm *lc_morehosts; /* Other hosts that share read lease */
- fsid_t lc_fsid; /* Fhandle */
- char lc_fiddata[MAXFIDSZ];
- struct vnode *lc_vp; /* Soft reference to associated vnode */
-};
-#define lc_flag lc_host.lph_un.un_udp.udp_flag
-
-/* lc_flag bits */
-#define LC_VALID 0x0001 /* Host address valid */
-#define LC_WRITE 0x0002 /* Write cache */
-#define LC_NONCACHABLE 0x0004 /* Non-cachable lease */
-#define LC_LOCKED 0x0008 /* Locked */
-#define LC_WANTED 0x0010 /* Lock wanted */
-#define LC_EXPIREDWANTED 0x0020 /* Want lease when expired */
-#define LC_UDP 0x0040 /* Host address for udp socket */
-#define LC_CLTP 0x0080 /* Host address for other connectionless */
-#define LC_LOCAL 0x0100 /* Host is server */
-#define LC_VACATED 0x0200 /* Host has vacated lease */
-#define LC_WRITTEN 0x0400 /* Recently wrote to the leased file */
-#define LC_SREF 0x0800 /* Holds a nfssvc_sock reference */
-
-struct nqm {
- struct nqm *lpm_next;
- struct nqhost lpm_hosts[LC_MOREHOSTSIZ];
-};
-
-/*
- * Special value for slp for local server calls.
- */
-#define NQLOCALSLP ((struct nfssvc_sock *) -1)
-
-/*
- * Server side macros.
- */
-#define nqsrv_getl(v, l) \
- (void) nqsrv_getlease((v), &nfsd->nd_duration, \
- ((nfsd->nd_flag & ND_LEASE) ? (nfsd->nd_flag & ND_LEASE) : \
- ((l) | ND_CHECK)), \
- slp, procp, nfsd->nd_nam, &cache, &frev, cred)
-
-/*
- * Client side macros that check for a valid lease.
- */
-#define NQNFS_CKINVALID(v, n, f) \
- ((time.tv_sec > (n)->n_expiry && \
- VFSTONFS((v)->v_mount)->nm_timeouts < VFSTONFS((v)->v_mount)->nm_deadthresh) \
- || ((f) == ND_WRITE && ((n)->n_flag & NQNFSWRITE) == 0))
-
-#define NQNFS_CKCACHABLE(v, f) \
- ((time.tv_sec <= VTONFS(v)->n_expiry || \
- VFSTONFS((v)->v_mount)->nm_timeouts >= VFSTONFS((v)->v_mount)->nm_deadthresh) \
- && (VTONFS(v)->n_flag & NQNFSNONCACHE) == 0 && \
- ((f) == ND_READ || (VTONFS(v)->n_flag & NQNFSWRITE)))
-
-#define NQNFS_NEEDLEASE(v, p) \
- (time.tv_sec > VTONFS(v)->n_expiry ? \
- ((VTONFS(v)->n_flag & NQNFSEVICTED) ? 0 : nqnfs_piggy[p]) : \
- (((time.tv_sec + NQ_RENEWAL) > VTONFS(v)->n_expiry && \
- nqnfs_piggy[p]) ? \
- ((VTONFS(v)->n_flag & NQNFSWRITE) ? \
- ND_WRITE : nqnfs_piggy[p]) : 0))
-
-/*
- * List head for timer queue.
- */
-CIRCLEQ_HEAD(, nqlease) nqtimerhead;
-
-/*
- * List head for the file handle hash table.
- */
-#define NQFHHASH(f) \
- (&nqfhhashtbl[(*((u_int32_t *)(f))) & nqfhhash])
-LIST_HEAD(nqfhhashhead, nqlease) *nqfhhashtbl;
-u_long nqfhhash;
-
-/*
- * Nqnfs return status numbers.
- */
-#define NQNFS_EXPIRED 500
-#define NQNFS_TRYLATER 501
-
-#ifdef _KERNEL
-void nqnfs_lease_updatetime __P((int));
-int nqsrv_cmpnam __P((struct nfssvc_sock *,struct mbuf *,struct nqhost *));
-int nqsrv_getlease __P((struct vnode *, u_int32_t *, int,
- struct nfssvc_sock *, struct proc *, struct mbuf *, int *,
- u_quad_t *, struct ucred *));
-int nqnfs_getlease __P((struct vnode *, int, struct ucred *,struct proc *));
-int nqnfs_callback __P((struct nfsmount *, struct mbuf *, struct mbuf *,
- caddr_t));
-int nqnfs_clientd __P((struct nfsmount *, struct ucred *,
- struct nfsd_cargs *, int, caddr_t, struct proc *));
-#endif
-
-#endif