summaryrefslogtreecommitdiffstats
path: root/sys/nfs
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
committerdyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
commit10f666af84d48e89e4e2960415c9b616fce4077f (patch)
tree88a944de263165091f0a18abeedbaaccec532407 /sys/nfs
parent0960d7e91af3428ffba89b42228d82d8afaa0389 (diff)
downloadFreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.zip
FreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.tar.gz
This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/nfs.h168
-rw-r--r--sys/nfs/nfs_bio.c26
-rw-r--r--sys/nfs/nfs_common.c26
-rw-r--r--sys/nfs/nfs_common.h3
-rw-r--r--sys/nfs/nfs_node.c14
-rw-r--r--sys/nfs/nfs_nqlease.c38
-rw-r--r--sys/nfs/nfs_serv.c32
-rw-r--r--sys/nfs/nfs_socket.c7
-rw-r--r--sys/nfs/nfs_srvcache.c2
-rw-r--r--sys/nfs/nfs_subs.c26
-rw-r--r--sys/nfs/nfs_syscalls.c4
-rw-r--r--sys/nfs/nfs_vfsops.c165
-rw-r--r--sys/nfs/nfs_vnops.c71
-rw-r--r--sys/nfs/nfsdiskless.h7
-rw-r--r--sys/nfs/nfsm_subs.h3
-rw-r--r--sys/nfs/nfsmount.h3
-rw-r--r--sys/nfs/nfsnode.h25
-rw-r--r--sys/nfs/nfsrtt.h3
-rw-r--r--sys/nfs/nfsrvcache.h3
-rw-r--r--sys/nfs/nqnfs.h3
-rw-r--r--sys/nfs/rpcv2.h3
-rw-r--r--sys/nfs/xdr_subs.h3
22 files changed, 375 insertions, 260 deletions
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index db41859..73a018c 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1989, 1993
+ * Copyright (c) 1989, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -33,19 +33,19 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs.h 8.1 (Berkeley) 6/10/93
+ * @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $FreeBSD$
*/
#ifndef _NFS_NFS_H_
#define _NFS_NFS_H_
-#include <nfs/rpcv2.h>
-
/*
* Tunable constants for nfs
*/
+#ifdef KERNEL
+
#define NFS_MAXIOVEC 34
#define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */
#define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */
@@ -69,7 +69,7 @@
#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */
#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */
#define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */
-#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runnable */
+#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */
#define NFS_MAXGATHERDELAY 100 /* Max. write gather delay (msec) */
#ifndef NFS_GATHERDELAY
#define NFS_GATHERDELAY 10 /* Default write gather delay (msec) */
@@ -89,30 +89,9 @@
/*
* XXX
- * sys/buf.h should be edited to change B_APPENDWRITE --> B_NEEDCOMMIT, but
- * until then...
- * Same goes for sys/malloc.h, which needs M_NFSDIROFF,
- * M_NFSRVDESC and M_NFSBIGFH added.
- * The VA_EXCLUSIVE flag should be added for va_vaflags and set for an
- * exclusive create.
* The B_INVAFTERWRITE flag should be set to whatever is required by the
* buffer cache code to say "Invalidate the block after it is written back".
*/
-#ifndef B_NEEDCOMMIT
-#define B_NEEDCOMMIT B_APPENDWRITE
-#endif
-#ifndef M_NFSRVDESC
-#define M_NFSRVDESC M_TEMP
-#endif
-#ifndef M_NFSDIROFF
-#define M_NFSDIROFF M_TEMP
-#endif
-#ifndef M_NFSBIGFH
-#define M_NFSBIGFH M_TEMP
-#endif
-#ifndef VA_EXCLUSIVE
-#define VA_EXCLUSIVE 0
-#endif
#ifdef __FreeBSD__
#define B_INVAFTERWRITE B_NOCACHE
#else
@@ -120,20 +99,6 @@
#endif
/*
- * These ifdefs try to handle the differences between the various 4.4BSD-Lite
- * based vfs interfaces.
- * btw: NetBSD-current does have a VOP_LEASDE(), but I don't know how to
- * differentiate between NetBSD-1.0 and NetBSD-current, so..
- * I also don't know about BSDi's 2.0 release.
- */
-#if !defined(HAS_VOPLEASE) && !defined(__FreeBSD__) && !defined(__NetBSD__)
-#define HAS_VOPLEASE 1
-#endif
-#if !defined(HAS_VOPREVOKE) && !defined(__FreeBSD__) && !defined(__NetBSD__)
-#define HAS_VOPREVOKE 1
-#endif
-
-/*
* The IO_METASYNC flag should be implemented for local file systems.
* (Until then, it is nothin at all.)
*/
@@ -164,13 +129,114 @@
#define NFS_SVCALLOC 256
#define NFS_UIDALLOC 128
+#endif /* KERNEL */
+
+/*
+ * NFS mount option flags
+ */
+#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
+#define NFSMNT_WSIZE 0x00000002 /* set write size */
+#define NFSMNT_RSIZE 0x00000004 /* set read size */
+#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
+#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
+#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */
+#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
+#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
+#define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */
+#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
+#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */
+#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
+#define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */
+#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
+#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */
+#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 */
+
+/*
+ * Arguments to mount NFS
+ */
+#define NFS_ARGSVERSION 3 /* change when nfs_args changes */
+struct nfs_args {
+ int version; /* args structure version number */
+ struct sockaddr *addr; /* file server address */
+ int addrlen; /* length of address */
+ int sotype; /* Socket type */
+ int proto; /* and Protocol */
+ u_char *fh; /* File handle to be mounted */
+ int fhsize; /* Size, in bytes, of fh */
+ int flags; /* flags */
+ int wsize; /* write size in bytes */
+ int rsize; /* read size in bytes */
+ int readdirsize; /* readdir size in bytes */
+ int timeo; /* initial timeout in .1 secs */
+ int retrans; /* times to retry send */
+ int maxgrouplist; /* Max. size of group list */
+ int readahead; /* # of blocks to readahead */
+ int leaseterm; /* Term (sec) of lease */
+ int deadthresh; /* Retrans threshold */
+ char *hostname; /* server's name */
+};
+
+/*
+ * NFS mount option flags
+ */
+#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
+#define NFSMNT_WSIZE 0x00000002 /* set write size */
+#define NFSMNT_RSIZE 0x00000004 /* set read size */
+#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
+#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
+#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */
+#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
+#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
+#define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */
+#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
+#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */
+#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
+#define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */
+#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
+#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */
+#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 */
+
/*
* Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
* should ever try and use it.
*/
struct nfsd_args {
int sock; /* Socket to serve */
- caddr_t name; /* Client address for connection based sockets */
+ caddr_t name; /* Client addr for connection based sockets */
int namelen; /* Length of name */
};
@@ -200,6 +266,10 @@ struct nfsd_cargs {
};
/*
+ * XXX to allow amd to include nfs.h without nfsproto.h
+ */
+#ifdef NFS_NPROCS
+/*
* Stats structure
*/
struct nfsstats {
@@ -237,6 +307,7 @@ struct nfsstats {
int srvnqnfs_getleases;
int srvvop_writes;
};
+#endif
/*
* Flags for nfssvc() system call.
@@ -267,7 +338,7 @@ struct nfsstats {
* such as SIGALRM will not expect file I/O system calls to be interrupted
* by them and break.
*/
-#if defined(KERNEL) || defined(_KERNEL)
+#ifdef KERNEL
struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
@@ -482,6 +553,8 @@ extern int nfsd_head_flag;
!bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \
sizeof (struct ucred)))
+
+int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
@@ -516,14 +589,12 @@ int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
u_long nfs_hash __P((nfsfh_t *,int));
-void nfsrv_slpderef __P((struct nfssvc_sock *slp));
int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **));
-void nfsrv_cleancache __P((void));
int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **));
-int nfs_init __P((void));
void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *));
+void nfsrv_cleancache __P((void));
int nfs_connect __P((struct nfsmount *,struct nfsreq *));
-void nfs_disconnect __P((struct nfsmount *nmp));
+void nfs_disconnect __P((struct nfsmount *));
int nfs_getattrcache __P((struct vnode *,struct vattr *));
int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *));
@@ -531,7 +602,6 @@ int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
void nfsrv_init __P((int));
void nfs_clearcommit __P((struct mount *));
int nfsrv_errmap __P((struct nfsrv_descript *, int));
-void nfsrv_rcv __P((struct socket *so, caddr_t arg, int waitflag));
void nfsrvw_sort __P((gid_t [],int));
void nfsrv_setcred __P((struct ucred *,struct ucred *));
int nfs_writebp __P((struct buf *,int));
@@ -594,8 +664,8 @@ int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
-
-
+void nfsrv_rcv __P((struct socket *so, caddr_t arg, int waitflag));
+void nfsrv_slpderef __P((struct nfssvc_sock *slp));
#endif /* KERNEL */
#endif
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index d67a3c0..0f636b0 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_bio.c 8.5 (Berkeley) 1/4/94
+ * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/resourcevar.h>
@@ -66,19 +67,6 @@ extern int nfs_numasync;
extern struct nfsstats nfsstats;
/*
- * Ifdefs for FreeBSD-current's merged VM/buffer cache. It is unfortunate
- * that this isn't done inside getblk() and brelse() so these calls
- * wouldn't need to be here.
- */
-#ifdef B_VMIO
-#define vnode_pager_uncache(vp)
-#else
-#define vfs_busy_pages(bp, f)
-#define vfs_unbusy_pages(bp)
-#define vfs_dirty_pages(bp)
-#endif
-
-/*
* Vnode op for read using bio
* Any similarity to readip() is purely coincidental
*/
@@ -195,7 +183,7 @@ nfs_bioread(vp, uio, ioflag, cred)
case VDIR:
break;
default:
- printf(" NQNFSNONCACHE: type %x unexpected\n",
+ printf(" NQNFSNONCACHE: type %x unexpected\n",
vp->v_type);
};
}
@@ -225,9 +213,8 @@ nfs_bioread(vp, uio, ioflag, cred)
vfs_unbusy_pages(rabp);
brelse(rabp);
}
- } else {
+ } else
brelse(rabp);
- }
}
}
}
@@ -270,6 +257,7 @@ again:
if (not_readin && n > 0) {
if (on < bp->b_validoff || (on + n) > bp->b_validend) {
bp->b_flags |= B_NOCACHE;
+ bp->b_flags |= B_INVAFTERWRITE;
if (bp->b_dirtyend > 0) {
if ((bp->b_flags & B_DELWRI) == 0)
panic("nfsbioread");
@@ -475,10 +463,6 @@ nfs_write(ap)
*/
biosize = vp->v_mount->mnt_stat.f_iosize;
do {
-
- /*
- * XXX make sure we aren't cached in the VM page cache
- */
/*
* Check for a valid write lease.
*/
diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c
index 1feadd6..5f83bf5 100644
--- a/sys/nfs/nfs_common.c
+++ b/sys/nfs/nfs_common.c
@@ -100,6 +100,7 @@ enum vtype nv3tov_type[8]= {
VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO
};
+int nfs_mount_type;
int nfs_ticks;
struct nfs_reqq nfs_reqq;
@@ -1093,7 +1094,8 @@ nfsm_strtmbuf(mb, bpos, cp, siz)
* Called once to initialize data structures...
*/
int
-nfs_init()
+nfs_init(vfsp)
+ struct vfsconf *vfsp;
{
register int i;
@@ -1116,6 +1118,7 @@ nfs_init()
printf("struct nfsuid bloated (> %dbytes)\n",NFS_UIDALLOC);
printf("Try unionizing the nu_nickname and nu_flag fields\n");
}
+ nfs_mount_type = vfsp->vfc_typenum;
nfsrtt.pos = 0;
rpc_vers = txdr_unsigned(RPC_VER2);
rpc_call = txdr_unsigned(RPC_CALL);
@@ -1170,10 +1173,10 @@ nfs_init()
* of the system can call us, if we are loadable.
*/
#ifndef NFS_NOSERVER
- lease_check = nfs_lease_check;
+ lease_check_hook = nqnfs_vop_lease_check;
#endif
lease_updatetime = nfs_lease_updatetime;
- vfsconf[MOUNT_NFS]->vfc_refcount++; /* make us non-unloadable */
+ vfsp->vfc_refcount++; /* make us non-unloadable */
#ifdef VFS_LKM
sysent[SYS_nfssvc].sy_narg = 2;
sysent[SYS_nfssvc].sy_call = nfssvc;
@@ -1212,7 +1215,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
register struct vattr *vap;
register struct nfs_fattr *fp;
register struct nfsnode *np;
- register struct nfsnodehashhead *nhpp;
register long t1;
caddr_t cp2;
int error = 0, rdev;
@@ -1222,6 +1224,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
struct timespec mtime;
struct vnode *nvp;
int v3 = NFS_ISV3(vp);
+ struct proc *p = curproc;
md = *mdp;
t1 = (mtod(md, caddr_t) + md->m_len) - *dposp;
@@ -1284,7 +1287,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
* then release it here.
*/
if (vtyp != VREG && VOP_ISLOCKED(vp))
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0, p);
vp->v_type = vtyp;
if (vp->v_type == VFIFO) {
vp->v_op = fifo_nfsv2nodeop_p;
@@ -1295,8 +1298,11 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
if (nvp) {
/*
* Discard unneeded vnode, but save its nfsnode.
+ * Since the nfsnode does not have a lock, its
+ * vnode lock has to be carried over.
*/
- LIST_REMOVE(np, n_hash);
+ nvp->v_vnlock = vp->v_vnlock;
+ vp->v_vnlock = NULL;
nvp->v_data = vp->v_data;
vp->v_data = NULL;
vp->v_op = spec_vnodeop_p;
@@ -1306,8 +1312,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
* Reinitialize aliased node.
*/
np->n_vnode = nvp;
- nhpp = NFSNOHASH(nfs_hash(np->n_fhp, np->n_fhsize));
- LIST_INSERT_HEAD(nhpp, np, n_hash);
*vpp = vp = nvp;
}
}
@@ -1714,13 +1718,14 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
int *rdonlyp;
int kerbflag;
{
+ struct proc *p = curproc; /* XXX */
register struct mount *mp;
register int i;
struct ucred *credanon;
int error, exflags;
*vpp = (struct vnode *)0;
- mp = getvfs(&fhp->fh_fsid);
+ mp = vfs_getvfs(&fhp->fh_fsid);
if (!mp)
return (ESTALE);
error = VFS_FHTOVP(mp, &fhp->fh_fid, nam, vpp, &exflags, &credanon);
@@ -1751,7 +1756,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
nfsrv_object_create(*vpp);
if (!lockflag)
- VOP_UNLOCK(*vpp);
+ VOP_UNLOCK(*vpp, 0, p);
return (0);
}
@@ -1947,3 +1952,4 @@ nfsrv_object_create(struct vnode *vp) {
return vfs_object_create(vp, curproc, curproc?curproc->p_ucred:NULL, 1);
}
#endif /* NFS_NOSERVER */
+
diff --git a/sys/nfs/nfs_common.h b/sys/nfs/nfs_common.h
index ac1a159..cd37c59 100644
--- a/sys/nfs/nfs_common.h
+++ b/sys/nfs/nfs_common.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfsm_subs.h 8.1 (Berkeley) 6/16/93
+ * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_NFSM_SUBS_H_
#define _NFS_NFSM_SUBS_H_
diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c
index 2ddb4a6..8403f55 100644
--- a/sys/nfs/nfs_node.c
+++ b/sys/nfs/nfs_node.c
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_node.c 8.2 (Berkeley) 12/30/93
+ * @(#)nfs_node.c 8.6 (Berkeley) 5/22/95
* $FreeBSD$
*/
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
@@ -108,7 +109,8 @@ nfs_nget(mntp, fhp, fhsize, npp)
int fhsize;
struct nfsnode **npp;
{
- register struct nfsnode *np;
+ struct proc *p = curproc; /* XXX */
+ struct nfsnode *np;
struct nfsnodehashhead *nhpp;
register struct vnode *vp;
struct vnode *nvp;
@@ -121,7 +123,7 @@ loop:
bcmp((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize))
continue;
vp = NFSTOV(np);
- if (vget(vp, 1))
+ if (vget(vp, LK_EXCLUSIVE, p))
goto loop;
*npp = np;
return(0);
@@ -178,7 +180,7 @@ loop:
/*
* Lock the new nfsnode.
*/
- VOP_LOCK(vp);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
return (0);
}
@@ -187,6 +189,7 @@ int
nfs_inactive(ap)
struct vop_inactive_args /* {
struct vnode *a_vp;
+ struct proc *a_p;
} */ *ap;
{
register struct nfsnode *np;
@@ -213,6 +216,7 @@ nfs_inactive(ap)
}
np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NQNFSEVICTED |
NQNFSNONCACHE | NQNFSWRITE);
+ VOP_UNLOCK(ap->a_vp, 0, ap->a_p);
return (0);
}
@@ -265,6 +269,7 @@ nfs_reclaim(ap)
return (0);
}
+#if 0
/*
* Lock an nfsnode
*/
@@ -355,6 +360,7 @@ nfs_islocked(ap)
{
return VTONFS(ap->a_vp)->n_flag & NLOCKED ? 1 : 0;
}
+#endif
/*
* Nfs abort op, called after namei() when a CREATE/DELETE isn't actually
diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c
index 2fa8360..1740b82 100644
--- a/sys/nfs/nfs_nqlease.c
+++ b/sys/nfs/nfs_nqlease.c
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_nqlease.c 8.3 (Berkeley) 1/4/94
+ * @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95
* $FreeBSD$
*/
+
/*
* References:
* Cary G. Gray and David R. Cheriton, "Leases: An Efficient Fault-Tolerant
@@ -84,11 +85,8 @@ struct vop_lease_args;
static int nqsrv_cmpnam __P((struct nfssvc_sock *,struct mbuf *,
struct nqhost *));
-extern void nqnfs_lease_check __P((struct vnode *vp, struct proc *p,
- struct ucred *cred, int flag));
extern void nqnfs_lease_updatetime __P((int deltat));
static int nqnfs_vacated __P((struct vnode *vp, struct ucred *cred));
-extern int nqnfs_vop_lease_check __P((struct vop_lease_args *ap));
static void nqsrv_addhost __P((struct nqhost *lph, struct nfssvc_sock *slp,
struct mbuf *nam));
static void nqsrv_instimeq __P((struct nqlease *lp, u_long duration));
@@ -136,6 +134,7 @@ extern nfstype nfsv3_type[9];
extern struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
extern int nfsd_waiting;
extern struct nfsstats nfsstats;
+extern int nfs_mount_type;
#define TRUE 1
#define FALSE 0
@@ -349,7 +348,6 @@ nqnfs_lease_check(vp, p, cred, flag)
#endif /* NFS_NOSERVER */
-#ifdef HAS_VOPLEASE
int
nqnfs_vop_lease_check(ap)
struct vop_lease_args /* {
@@ -367,7 +365,6 @@ nqnfs_vop_lease_check(ap)
NQLOCALSLP, ap->a_p, (struct mbuf *)0, &cache, &frev, ap->a_cred);
return (0);
}
-#endif
/*
* Add a host to an nqhost structure for a lease.
@@ -1090,7 +1087,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
vp = NFSTOV(np);
vpid = vp->v_id;
if (np->n_expiry < time.tv_sec) {
- if (vget(vp, 1) == 0) {
+ if (vget(vp, LK_EXCLUSIVE, p) == 0) {
nmp->nm_inprog = vp;
if (vpid == vp->v_id) {
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
@@ -1115,7 +1112,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
} else if ((np->n_expiry - NQ_RENEWAL) < time.tv_sec) {
if ((np->n_flag & (NQNFSWRITE | NQNFSNONCACHE))
== NQNFSWRITE && vp->v_dirtyblkhd.lh_first &&
- vget(vp, 1) == 0) {
+ vget(vp, LK_EXCLUSIVE, p) == 0) {
nmp->nm_inprog = vp;
if (vpid == vp->v_id &&
nqnfs_getlease(vp, ND_WRITE, cred, p)==0)
@@ -1179,9 +1176,10 @@ void
nqnfs_lease_updatetime(deltat)
register int deltat;
{
- register struct nqlease *lp;
- register struct nfsnode *np;
- struct mount *mp;
+ struct proc *p = curproc; /* XXX */
+ struct nqlease *lp;
+ struct nfsnode *np;
+ struct mount *mp, *nxtmp;
struct nfsmount *nmp;
int s;
@@ -1197,13 +1195,13 @@ nqnfs_lease_updatetime(deltat)
* Search the mount list for all nqnfs mounts and do their timer
* queues.
*/
- for (mp = mountlist.cqh_first; mp != (void *)&mountlist;
- mp = mp->mnt_list.cqe_next) {
-#ifdef __NetBSD__
- if (!strcmp(&mp->mnt_stat.f_fstypename[0], MOUNT_NFS)) {
-#else
- if (mp->mnt_stat.f_fsid.val[1] == MOUNT_NFS) {
-#endif
+ 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 (mp->mnt_stat.f_type == nfs_mount_type) {
nmp = VFSTONFS(mp);
if (nmp->nm_flag & NFSMNT_NQNFS) {
for (np = nmp->nm_timerhead.cqh_first;
@@ -1213,7 +1211,11 @@ nqnfs_lease_updatetime(deltat)
}
}
}
+ simple_lock(&mountlist_slock);
+ nxtmp = mp->mnt_list.cqe_next;
+ vfs_unbusy(mp, p);
}
+ simple_unlock(&mountlist_slock);
}
/*
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 3946778..28a705a 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -1723,7 +1723,7 @@ nfsrv_remove(nfsd, slp, procp, mrq)
}
out:
if (!error) {
- vnode_pager_uncache(vp);
+ vnode_pager_uncache(vp, procp);
nqsrv_getl(nd.ni_dvp, ND_WRITE);
nqsrv_getl(vp, ND_WRITE);
@@ -1900,7 +1900,7 @@ out:
nqsrv_getl(tdvp, ND_WRITE);
if (tvp) {
nqsrv_getl(tvp, ND_WRITE);
- (void) vnode_pager_uncache(tvp);
+ (void) vnode_pager_uncache(tvp, procp);
}
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
@@ -2027,11 +2027,7 @@ out:
if (!error) {
nqsrv_getl(vp, ND_WRITE);
nqsrv_getl(xp, ND_WRITE);
-#if defined(__NetBSD__) || defined(__FreeBSD__)
- error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
-#else
error = VOP_LINK(vp, nd.ni_dvp, &nd.ni_cnd);
-#endif
} else {
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_dvp == nd.ni_vp)
@@ -2479,7 +2475,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq)
int siz, cnt, fullsiz, eofflag, rdonly, cache, ncookies;
int v3 = (nfsd->nd_flag & ND_NFSV3);
u_quad_t frev, off, toff, verf;
- u_int *cookies = NULL, *cookiep;
+ u_long *cookies = NULL, *cookiep;
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
@@ -2520,7 +2516,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq)
nfsm_srvpostop_attr(getret, &at);
return (0);
}
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0, procp);
MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK);
#ifdef __NetBSD__
ncookies = siz / (5 * NFSX_UNSIGNED); /*7 for V3, but it's an est. so*/
@@ -2538,16 +2534,12 @@ again:
io.uio_rw = UIO_READ;
io.uio_procp = (struct proc *)0;
eofflag = 0;
- VOP_LOCK(vp);
-#ifndef __NetBSD__
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, procp);
if (cookies) {
free((caddr_t)cookies, M_TEMP);
cookies = NULL;
}
error = VOP_READDIR(vp, &io, cred, &eofflag, &ncookies, &cookies);
-#else
- error = VOP_READDIR(vp, &io, cred, &eofflag, cookies, ncookies);
-#endif
off = (off_t)io.uio_offset;
if (!cookies && !error)
error = NFSERR_PERM;
@@ -2556,7 +2548,7 @@ again:
if (!error)
error = getret;
}
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0, procp);
if (error) {
vrele(vp);
free((caddr_t)rbuf, M_TEMP);
@@ -2751,7 +2743,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq)
int len, nlen, rem, xfer, tsiz, i, error = 0, getret = 1;
int siz, cnt, fullsiz, eofflag, rdonly, cache, dirlen, ncookies;
u_quad_t frev, off, toff, verf;
- u_int *cookies = NULL, *cookiep;
+ u_long *cookies = NULL, *cookiep;
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
@@ -2787,7 +2779,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq)
nfsm_srvpostop_attr(getret, &at);
return (0);
}
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0, procp);
MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK);
#ifdef __NetBSD__
ncookies = siz / (7 * NFSX_UNSIGNED);
@@ -2805,19 +2797,15 @@ again:
io.uio_rw = UIO_READ;
io.uio_procp = (struct proc *)0;
eofflag = 0;
- VOP_LOCK(vp);
-#ifndef __NetBSD__
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, procp);
if (cookies) {
free((caddr_t)cookies, M_TEMP);
cookies = NULL;
}
error = VOP_READDIR(vp, &io, cred, &eofflag, &ncookies, &cookies);
-#else
- error = VOP_READDIR(vp, &io, cred, &eofflag, cookies, ncookies);
-#endif
off = (u_quad_t)io.uio_offset;
getret = VOP_GETATTR(vp, &at, cred, procp);
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0, procp);
if (!cookies && !error)
error = NFSERR_PERM;
if (!error)
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index addd59f..ed16333 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1989, 1991, 1993
+ * Copyright (c) 1989, 1991, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_socket.c 8.3 (Berkeley) 1/12/94
+ * @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
* $FreeBSD$
*/
@@ -1925,6 +1925,9 @@ nfs_getreq(nd, nfsd, has_header)
struct mbuf *mrep, *md;
register struct nfsuid *nuidp;
struct timeval tvin, tvout;
+#if 0 /* until encrypted keys are implemented */
+ NFSKERBKEYSCHED_T keys; /* stores key schedule */
+#endif
mrep = nd->nd_mrep;
md = nd->nd_md;
diff --git a/sys/nfs/nfs_srvcache.c b/sys/nfs/nfs_srvcache.c
index 835ec06..efff221 100644
--- a/sys/nfs/nfs_srvcache.c
+++ b/sys/nfs/nfs_srvcache.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_srvcache.c 8.1 (Berkeley) 6/10/93
+ * @(#)nfs_srvcache.c 8.3 (Berkeley) 3/30/95
* $FreeBSD$
*/
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 1feadd6..5f83bf5 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -100,6 +100,7 @@ enum vtype nv3tov_type[8]= {
VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO
};
+int nfs_mount_type;
int nfs_ticks;
struct nfs_reqq nfs_reqq;
@@ -1093,7 +1094,8 @@ nfsm_strtmbuf(mb, bpos, cp, siz)
* Called once to initialize data structures...
*/
int
-nfs_init()
+nfs_init(vfsp)
+ struct vfsconf *vfsp;
{
register int i;
@@ -1116,6 +1118,7 @@ nfs_init()
printf("struct nfsuid bloated (> %dbytes)\n",NFS_UIDALLOC);
printf("Try unionizing the nu_nickname and nu_flag fields\n");
}
+ nfs_mount_type = vfsp->vfc_typenum;
nfsrtt.pos = 0;
rpc_vers = txdr_unsigned(RPC_VER2);
rpc_call = txdr_unsigned(RPC_CALL);
@@ -1170,10 +1173,10 @@ nfs_init()
* of the system can call us, if we are loadable.
*/
#ifndef NFS_NOSERVER
- lease_check = nfs_lease_check;
+ lease_check_hook = nqnfs_vop_lease_check;
#endif
lease_updatetime = nfs_lease_updatetime;
- vfsconf[MOUNT_NFS]->vfc_refcount++; /* make us non-unloadable */
+ vfsp->vfc_refcount++; /* make us non-unloadable */
#ifdef VFS_LKM
sysent[SYS_nfssvc].sy_narg = 2;
sysent[SYS_nfssvc].sy_call = nfssvc;
@@ -1212,7 +1215,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
register struct vattr *vap;
register struct nfs_fattr *fp;
register struct nfsnode *np;
- register struct nfsnodehashhead *nhpp;
register long t1;
caddr_t cp2;
int error = 0, rdev;
@@ -1222,6 +1224,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
struct timespec mtime;
struct vnode *nvp;
int v3 = NFS_ISV3(vp);
+ struct proc *p = curproc;
md = *mdp;
t1 = (mtod(md, caddr_t) + md->m_len) - *dposp;
@@ -1284,7 +1287,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
* then release it here.
*/
if (vtyp != VREG && VOP_ISLOCKED(vp))
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0, p);
vp->v_type = vtyp;
if (vp->v_type == VFIFO) {
vp->v_op = fifo_nfsv2nodeop_p;
@@ -1295,8 +1298,11 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
if (nvp) {
/*
* Discard unneeded vnode, but save its nfsnode.
+ * Since the nfsnode does not have a lock, its
+ * vnode lock has to be carried over.
*/
- LIST_REMOVE(np, n_hash);
+ nvp->v_vnlock = vp->v_vnlock;
+ vp->v_vnlock = NULL;
nvp->v_data = vp->v_data;
vp->v_data = NULL;
vp->v_op = spec_vnodeop_p;
@@ -1306,8 +1312,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
* Reinitialize aliased node.
*/
np->n_vnode = nvp;
- nhpp = NFSNOHASH(nfs_hash(np->n_fhp, np->n_fhsize));
- LIST_INSERT_HEAD(nhpp, np, n_hash);
*vpp = vp = nvp;
}
}
@@ -1714,13 +1718,14 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
int *rdonlyp;
int kerbflag;
{
+ struct proc *p = curproc; /* XXX */
register struct mount *mp;
register int i;
struct ucred *credanon;
int error, exflags;
*vpp = (struct vnode *)0;
- mp = getvfs(&fhp->fh_fsid);
+ mp = vfs_getvfs(&fhp->fh_fsid);
if (!mp)
return (ESTALE);
error = VFS_FHTOVP(mp, &fhp->fh_fid, nam, vpp, &exflags, &credanon);
@@ -1751,7 +1756,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
nfsrv_object_create(*vpp);
if (!lockflag)
- VOP_UNLOCK(*vpp);
+ VOP_UNLOCK(*vpp, 0, p);
return (0);
}
@@ -1947,3 +1952,4 @@ nfsrv_object_create(struct vnode *vp) {
return vfs_object_create(vp, curproc, curproc?curproc->p_ucred:NULL, 1);
}
#endif /* NFS_NOSERVER */
+
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 734fe79..24d4bd6 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_syscalls.c 8.3 (Berkeley) 1/4/94
+ * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
* $FreeBSD$
*/
@@ -97,7 +97,6 @@ static int nfssvc_iod __P((struct proc *));
static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
-
#ifndef NFS_NOSERVER
int nfsd_waiting = 0;
static struct nfsdrt nfsdrt;
@@ -1051,6 +1050,7 @@ nfsmout:
}
#ifndef NFS_NOSERVER
+
/*
* Derefence a server socket structure. If it has no more references and
* is no longer valid, you can throw it away.
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index 937c2d5..06457f1 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1989, 1993
+ * Copyright (c) 1989, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94
+ * @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
* $FreeBSD$
*/
@@ -121,7 +121,7 @@ static struct vfsops nfs_vfsops = {
nfs_vget,
nfs_fhtovp,
nfs_vptofh,
- nfs_init,
+ nfs_init
};
VFS_SET(nfs_vfsops, nfs, MOUNT_NFS, VFCF_NETWORK);
@@ -152,8 +152,10 @@ SYSCTL_OPAQUE(_vfs_nfs, OID_AUTO, diskless_swapaddr, CTLFLAG_RD,
void nfsargs_ntoh __P((struct nfs_args *));
-static struct mount *nfs_mountdiskless __P((char *, char *, int,
- struct sockaddr_in *, struct nfs_args *, register struct vnode **));
+static int nfs_mountdiskless __P((char *, char *, int,
+ struct sockaddr_in *, struct nfs_args *,
+ struct proc *, struct vnode **,
+ struct mount **));
static int nfs_iosize(nmp)
struct nfsmount* nmp;
@@ -329,8 +331,8 @@ nfs_fsinfo(nmp, vp, cred, p)
int
nfs_mountroot()
{
- register struct mount *mp;
- register struct nfs_diskless *nd = &nfs_diskless;
+ struct mount *mp, *swap_mp;
+ struct nfs_diskless *nd = &nfs_diskless;
struct socket *so;
struct vnode *vp;
struct proc *p = curproc; /* XXX */
@@ -406,6 +408,7 @@ nfs_mountroot()
panic("nfs_mountroot: RTM_ADD: %d", error);
}
+ swap_mp = NULL;
if (nd->swap_nblks) {
/* Convert to DEV_BSIZE instead of Kilobyte */
@@ -426,8 +429,10 @@ nfs_mountroot()
(l >> 24) & 0xff, (l >> 16) & 0xff,
(l >> 8) & 0xff, (l >> 0) & 0xff,nd->swap_hostnam);
printf("NFS SWAP: %s\n",buf);
- (void) nfs_mountdiskless(buf, "/swap", 0,
- &nd->swap_saddr, &nd->swap_args, &vp);
+ if (error = nfs_mountdiskless(buf, "/swap", 0,
+ &nd->swap_saddr, &nd->swap_args, p, &vp, &swap_mp))
+ return (error);
+ vfs_unbusy(swap_mp, p);
VTONFS(vp)->n_size = VTONFS(vp)->n_vattr.va_size =
nd->swap_nblks * DEV_BSIZE ;
@@ -455,16 +460,22 @@ nfs_mountroot()
(l >> 24) & 0xff, (l >> 16) & 0xff,
(l >> 8) & 0xff, (l >> 0) & 0xff,nd->root_hostnam);
printf("NFS ROOT: %s\n",buf);
- mp = nfs_mountdiskless(buf, "/", MNT_RDONLY,
- &nd->root_saddr, &nd->root_args, &vp);
+ if (error = nfs_mountdiskless(buf, "/", MNT_RDONLY,
+ &nd->root_saddr, &nd->root_args, p, &vp, &mp)) {
+ if (swap_mp) {
+ mp->mnt_vfc->vfc_refcount--;
+ free(swap_mp, M_MOUNT);
+ }
+ return (error);
+ }
- if (vfs_lock(mp))
- panic("nfs_mountroot: vfs_lock");
+ simple_lock(&mountlist_slock);
CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
+ simple_unlock(&mountlist_slock);
mp->mnt_flag |= MNT_ROOTFS;
mp->mnt_vnodecovered = NULLVP;
- vfs_unlock(mp);
rootvp = vp;
+ vfs_unbusy(mp, p);
/*
* This is not really an nfs issue, but it is much easier to
@@ -483,39 +494,65 @@ nfs_mountroot()
/*
* Internal version of mount system call for diskless setup.
*/
-static struct mount *
-nfs_mountdiskless(path, which, mountflag, sin, args, vpp)
+static int
+nfs_mountdiskless(path, which, mountflag, sin, args, p, vpp, mpp)
char *path;
char *which;
int mountflag;
struct sockaddr_in *sin;
struct nfs_args *args;
- register struct vnode **vpp;
+ struct proc *p;
+ struct vnode **vpp;
+ struct mount **mpp;
{
- register struct mount *mp;
- register struct mbuf *m;
- register int error;
-
- mp = (struct mount *)malloc((u_long)sizeof(struct mount),
- M_MOUNT, M_NOWAIT);
- if (mp == NULL)
- panic("nfs_mountroot: %s mount malloc", which);
- bzero((char *)mp, (u_long)sizeof(struct mount));
- mp->mnt_op = &nfs_vfsops;
- mp->mnt_flag = mountflag;
+ struct mount *mp;
+ struct mbuf *m;
+ int error;
- MGET(m, MT_SONAME, M_DONTWAIT);
- if (m == NULL)
- panic("nfs_mountroot: %s mount mbuf", which);
+ if (error = vfs_rootmountalloc("nfs", path, &mp)) {
+ printf("nfs_mountroot: NFS not configured");
+ return (error);
+ }
+ mp->mnt_flag = mountflag;
+ MGET(m, MT_SONAME, M_WAITOK);
bcopy((caddr_t)sin, mtod(m, caddr_t), sin->sin_len);
m->m_len = sin->sin_len;
- error = mountnfs(args, mp, m, which, path, vpp);
- if (error)
- panic("nfs_mountroot: mount %s on %s: %d", path, which, error);
-
- return (mp);
+ if (error = mountnfs(args, mp, m, which, path, vpp)) {
+ printf("nfs_mountroot: mount %s on %s: %d", path, which, error);
+ mp->mnt_vfc->vfc_refcount--;
+ vfs_unbusy(mp, p);
+ free(mp, M_MOUNT);
+ return (error);
+ }
+ (void) copystr(which, mp->mnt_stat.f_mntonname, MNAMELEN - 1, 0);
+ *mpp = mp;
+ return (0);
}
+#ifdef COMPAT_PRELITE2
+/*
+ * Old arguments to mount NFS
+ */
+struct onfs_args {
+ struct sockaddr *addr; /* file server address */
+ int addrlen; /* length of address */
+ int sotype; /* Socket type */
+ int proto; /* and Protocol */
+ u_char *fh; /* File handle to be mounted */
+ int fhsize; /* Size, in bytes, of fh */
+ int flags; /* flags */
+ int wsize; /* write size in bytes */
+ int rsize; /* read size in bytes */
+ int readdirsize; /* readdir size in bytes */
+ int timeo; /* initial timeout in .1 secs */
+ int retrans; /* times to retry send */
+ int maxgrouplist; /* Max. size of group list */
+ int readahead; /* # of blocks to readahead */
+ int leaseterm; /* Term (sec) of lease */
+ int deadthresh; /* Retrans threshold */
+ char *hostname; /* server's name */
+};
+#endif
/*
* VFS Operations.
@@ -546,6 +583,39 @@ nfs_mount(mp, path, data, ndp, p)
error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args));
if (error)
return (error);
+ if (args.version != NFS_ARGSVERSION) {
+#ifdef COMPAT_PRELITE2
+ /*
+ * If the argument version is unknown, then assume the
+ * caller is a pre-lite2 4.4BSD client and convert its
+ * arguments.
+ */
+ struct onfs_args oargs;
+ error = copyin(data, (caddr_t)&oargs, sizeof (struct onfs_args));
+ if (error)
+ return (error);
+ args.version = NFS_ARGSVERSION;
+ args.addr = oargs.addr;
+ args.addrlen = oargs.addrlen;
+ args.sotype = oargs.sotype;
+ args.proto = oargs.proto;
+ args.fh = oargs.fh;
+ args.fhsize = oargs.fhsize;
+ args.flags = oargs.flags;
+ args.wsize = oargs.wsize;
+ args.rsize = oargs.rsize;
+ args.readdirsize = oargs.readdirsize;
+ args.timeo = oargs.timeo;
+ args.retrans = oargs.retrans;
+ args.maxgrouplist = oargs.maxgrouplist;
+ args.readahead = oargs.readahead;
+ args.leaseterm = oargs.leaseterm;
+ args.deadthresh = oargs.deadthresh;
+ args.hostname = oargs.hostname;
+#else /* COMPAT_PRELITE2 */
+ return (EPROGMISMATCH);
+#endif /* COMPAT_PRELITE2 */
+ }
error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize);
if (error)
return (error);
@@ -595,7 +665,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
TAILQ_INIT(&nmp->nm_bufq);
mp->mnt_data = (qaddr_t)nmp;
}
- getnewfsid(mp, MOUNT_NFS);
+ vfs_getnewfsid(mp);
nmp->nm_mountp = mp;
nmp->nm_flag = argp->flags;
if (nmp->nm_flag & NFSMNT_NQNFS)
@@ -619,15 +689,6 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
nmp->nm_inprog = NULLVP;
nmp->nm_fhsize = argp->fhsize;
bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize);
-#ifdef __NetBSD__
-#ifdef COMPAT_09
- mp->mnt_stat.f_type = 2;
-#else
- mp->mnt_stat.f_type = 0;
-#endif
-#else
- mp->mnt_stat.f_type = MOUNT_NFS;
-#endif
bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN);
bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN);
nmp->nm_nam = nam;
@@ -741,7 +802,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
/*
* Lose the lock but keep the ref.
*/
- VOP_UNLOCK(*vpp);
+ VOP_UNLOCK(*vpp, 0, curproc);
return (0);
bad:
@@ -765,11 +826,8 @@ nfs_unmount(mp, mntflags, p)
struct vnode *vp;
int error, flags = 0;
- if (mntflags & MNT_FORCE) {
- if (!doforce)
- return (EINVAL);
+ if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
- }
nmp = VFSTONFS(mp);
/*
* Goes something like this..
@@ -846,7 +904,7 @@ nfs_root(mp, vpp)
if (error)
return (error);
vp = NFSTOV(np);
- VOP_UNLOCK(vp);
+ VOP_UNLOCK(vp, 0, curproc);
if (vp->v_type == VNON)
vp->v_type = VDIR;
vp->v_flag = VROOT;
@@ -885,7 +943,7 @@ loop:
goto loop;
if (VOP_ISLOCKED(vp) || vp->v_dirtyblkhd.lh_first == NULL)
continue;
- if (vget(vp, 1))
+ if (vget(vp, LK_EXCLUSIVE, p))
goto loop;
error = VOP_FSYNC(vp, cred, waitfor, p);
if (error)
@@ -969,4 +1027,3 @@ nfs_quotactl(mp, cmd, uid, arg, p)
return (EOPNOTSUPP);
}
-
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index b8ff396..905bb22 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94
+ * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
* $FreeBSD$
*/
+
/*
* vnode op calls for Sun NFS version 2 and 3
*/
@@ -151,14 +152,10 @@ static struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = {
{ &vop_setattr_desc, (vop_t *)nfs_setattr }, /* setattr */
{ &vop_read_desc, (vop_t *)nfs_read }, /* read */
{ &vop_write_desc, (vop_t *)nfs_write }, /* write */
-#ifdef HAS_VOPLEASE
{ &vop_lease_desc, (vop_t *)nfs_lease_check }, /* lease */
-#endif
{ &vop_ioctl_desc, (vop_t *)nfs_ioctl }, /* ioctl */
{ &vop_select_desc, (vop_t *)nfs_select }, /* select */
-#ifdef HAS_VOPREVOKE
{ &vop_revoke_desc, (vop_t *)nfs_revoke }, /* revoke */
-#endif
{ &vop_mmap_desc, (vop_t *)nfs_mmap }, /* mmap */
{ &vop_fsync_desc, (vop_t *)nfs_fsync }, /* fsync */
{ &vop_seek_desc, (vop_t *)nfs_seek }, /* seek */
@@ -212,14 +209,10 @@ static struct vnodeopv_entry_desc spec_nfsv2nodeop_entries[] = {
{ &vop_setattr_desc, (vop_t *)nfs_setattr }, /* setattr */
{ &vop_read_desc, (vop_t *)nfsspec_read }, /* read */
{ &vop_write_desc, (vop_t *)nfsspec_write }, /* write */
-#ifdef HAS_VOPLEASE
{ &vop_lease_desc, (vop_t *)spec_lease_check }, /* lease */
-#endif
{ &vop_ioctl_desc, (vop_t *)spec_ioctl }, /* ioctl */
{ &vop_select_desc, (vop_t *)spec_select }, /* select */
-#ifdef HAS_VOPREVOKE
{ &vop_revoke_desc, (vop_t *)spec_revoke }, /* revoke */
-#endif
{ &vop_mmap_desc, (vop_t *)spec_mmap }, /* mmap */
{ &vop_fsync_desc, (vop_t *)nfs_fsync }, /* fsync */
{ &vop_seek_desc, (vop_t *)spec_seek }, /* seek */
@@ -270,14 +263,10 @@ static struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = {
{ &vop_setattr_desc, (vop_t *)nfs_setattr }, /* setattr */
{ &vop_read_desc, (vop_t *)nfsfifo_read }, /* read */
{ &vop_write_desc, (vop_t *)nfsfifo_write }, /* write */
-#ifdef HAS_VOPLEASE
{ &vop_lease_desc, (vop_t *)fifo_lease_check }, /* lease */
-#endif
{ &vop_ioctl_desc, (vop_t *)fifo_ioctl }, /* ioctl */
{ &vop_select_desc, (vop_t *)fifo_select }, /* select */
-#ifdef HAS_VOPREVOKE
{ &vop_revoke_desc, (vop_t *)fifo_revoke }, /* revoke */
-#endif
{ &vop_mmap_desc, (vop_t *)fifo_mmap }, /* mmap */
{ &vop_fsync_desc, (vop_t *)nfs_fsync }, /* fsync */
{ &vop_seek_desc, (vop_t *)fifo_seek }, /* seek */
@@ -469,7 +458,7 @@ nfs_open(ap)
if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
ap->a_p, 1)) == EINTR)
return (error);
- (void) vnode_pager_uncache(vp);
+ (void) vnode_pager_uncache(vp, ap->a_p);
np->n_brev = np->n_lrev;
}
}
@@ -588,7 +577,7 @@ nfs_getattr(ap)
int error = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
int v3 = NFS_ISV3(vp);
-
+
/*
* Update local times for special files.
*/
@@ -634,7 +623,7 @@ nfs_setattr(ap)
/*
* Disallow write attempts if the filesystem is mounted read-only.
*/
- if ((vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
+ if ((vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) &&
(vp->v_mount->mnt_flag & MNT_RDONLY))
@@ -645,6 +634,8 @@ nfs_setattr(ap)
return (EISDIR);
case VCHR:
case VBLK:
+ case VSOCK:
+ case VFIFO:
if (vap->va_mtime.tv_sec == VNOVAL &&
vap->va_atime.tv_sec == VNOVAL &&
vap->va_mode == (u_short)VNOVAL &&
@@ -660,20 +651,22 @@ nfs_setattr(ap)
*/
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
- if (vap->va_size == 0)
+ if (np->n_flag & NMODIFIED) {
+ if (vap->va_size == 0)
error = nfs_vinvalbuf(vp, 0,
ap->a_cred, ap->a_p, 1);
- else
+ else
error = nfs_vinvalbuf(vp, V_SAVE,
ap->a_cred, ap->a_p, 1);
- if (error)
+ if (error)
return (error);
+ }
tsize = np->n_size;
np->n_size = np->n_vattr.va_size = vap->va_size;
vnode_pager_setsize(vp, (u_long)np->n_size);
};
} else if ((vap->va_mtime.tv_sec != VNOVAL ||
- vap->va_atime.tv_sec != VNOVAL) &&
+ vap->va_atime.tv_sec != VNOVAL) && (np->n_flag & NMODIFIED) &&
vp->v_type == VREG &&
(error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
ap->a_p, 1)) == EINTR)
@@ -826,6 +819,7 @@ nfs_lookup(ap)
struct nfsnode *np;
int lockparent, wantparent, error = 0, attrflag, fhsize;
int v3 = NFS_ISV3(dvp);
+ struct proc *p = cnp->cn_proc;
if ((flags & ISLASTCN) && (dvp->v_mount->mnt_flag & MNT_RDONLY) &&
(cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
@@ -851,18 +845,18 @@ nfs_lookup(ap)
VREF(newvp);
error = 0;
} else if (flags & ISDOTDOT) {
- VOP_UNLOCK(dvp);
- error = vget(newvp, 1);
+ VOP_UNLOCK(dvp, 0, p);
+ error = vget(newvp, LK_EXCLUSIVE, p);
if (!error && lockparent && (flags & ISLASTCN))
- error = VOP_LOCK(dvp);
+ error = vn_lock(dvp, LK_EXCLUSIVE, p);
} else {
- error = vget(newvp, 1);
+ error = vget(newvp, LK_EXCLUSIVE, p);
if (!lockparent || error || !(flags & ISLASTCN))
- VOP_UNLOCK(dvp);
+ VOP_UNLOCK(dvp, 0, p);
}
if (!error) {
if (vpid == newvp->v_id) {
- if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, cnp->cn_proc)
+ if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, p)
&& vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
nfsstats.lookupcache_hits++;
if (cnp->cn_nameiop != LOOKUP &&
@@ -874,9 +868,9 @@ nfs_lookup(ap)
}
vput(newvp);
if (lockparent && dvp != newvp && (flags & ISLASTCN))
- VOP_UNLOCK(dvp);
+ VOP_UNLOCK(dvp, 0, p);
}
- error = VOP_LOCK(dvp);
+ error = vn_lock(dvp, LK_EXCLUSIVE, p);
if (error)
return (error);
*vpp = NULLVP;
@@ -920,20 +914,20 @@ nfs_lookup(ap)
m_freem(mrep);
cnp->cn_flags |= SAVENAME;
if (!lockparent)
- VOP_UNLOCK(dvp);
+ VOP_UNLOCK(dvp, 0, p);
return (0);
}
if (flags & ISDOTDOT) {
- VOP_UNLOCK(dvp);
+ VOP_UNLOCK(dvp, 0, p);
error = nfs_nget(dvp->v_mount, fhp, fhsize, &np);
if (error) {
- VOP_LOCK(dvp);
+ vn_lock(dvp, LK_EXCLUSIVE + LK_RETRY, p);
return (error);
}
newvp = NFSTOV(np);
if (lockparent && (flags & ISLASTCN) &&
- (error = VOP_LOCK(dvp))) {
+ (error = vn_lock(dvp, LK_EXCLUSIVE, p))) {
vput(newvp);
return (error);
}
@@ -946,7 +940,7 @@ nfs_lookup(ap)
return (error);
}
if (!lockparent || !(flags & ISLASTCN))
- VOP_UNLOCK(dvp);
+ VOP_UNLOCK(dvp, 0, p);
newvp = NFSTOV(np);
}
if (v3) {
@@ -969,7 +963,7 @@ nfs_lookup(ap)
if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
(flags & ISLASTCN) && error == ENOENT) {
if (!lockparent)
- VOP_UNLOCK(dvp);
+ VOP_UNLOCK(dvp, 0, p);
if (dvp->v_mount->mnt_flag & MNT_RDONLY)
error = EROFS;
else
@@ -2110,7 +2104,7 @@ nfs_readdirrpc(vp, uiop, cred)
}
nfsm_dissect(tl, u_long *, NFSX_UNSIGNED);
more_dirs = fxdr_unsigned(int, *tl);
-
+
/* loop thru the dir entries, doctoring them to 4bsd form */
while (more_dirs && bigenough) {
if (v3) {
@@ -2923,6 +2917,9 @@ loop:
}
}
if (vp->v_dirtyblkhd.lh_first && commit) {
+#ifndef DIAGNOSTIC
+ vprint("nfs_fsync: dirty", vp);
+#endif
goto loop;
}
}
@@ -3131,7 +3128,7 @@ nfs_writebp(bp, force)
* an actual write will have to be scheduled via. VOP_STRATEGY().
* If B_WRITEINPROG is already set, then push it with a write anyhow.
*/
- if (oldflags & (B_NEEDCOMMIT | B_WRITEINPROG) == B_NEEDCOMMIT) {
+ if ((oldflags & (B_NEEDCOMMIT | B_WRITEINPROG)) == B_NEEDCOMMIT) {
off = ((u_quad_t)bp->b_blkno) * DEV_BSIZE + bp->b_dirtyoff;
bp->b_flags |= B_WRITEINPROG;
retv = nfs_commit(bp->b_vp, off, bp->b_dirtyend-bp->b_dirtyoff,
@@ -3205,7 +3202,7 @@ nfsspec_access(ap)
if (cred->cr_uid == 0)
return (0);
vap = &vattr;
- error = VOP_GETATTR(ap->a_vp, vap, cred, ap->a_p);
+ error = VOP_GETATTR(vp, vap, cred, ap->a_p);
if (error)
return (error);
/*
diff --git a/sys/nfs/nfsdiskless.h b/sys/nfs/nfsdiskless.h
index 117548b..4777818 100644
--- a/sys/nfs/nfsdiskless.h
+++ b/sys/nfs/nfsdiskless.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfsdiskless.h 8.1 (Berkeley) 6/10/93
+ * @(#)nfsdiskless.h 8.2 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_NFSDISKLESS_H_
#define _NFS_NFSDISKLESS_H_
@@ -46,8 +47,8 @@
* vnodes plus do a partial ifconfig(8) and route(8) so that the critical net
* interface can communicate with the server.
* The primary bootstrap is expected to fill in the appropriate fields before
- * starting the kernel. Whether or not the swap area is nfs mounted is determined
- * by the value in swdevt[0]. (equal to NODEV --> swap over nfs)
+ * starting the kernel. Whether or not the swap area is nfs mounted is
+ * determined by the value in swdevt[0]. (equal to NODEV --> swap over nfs)
* Currently only works for AF_INET protocols.
* NB: All fields are stored in net byte order to avoid hassles with
* client/server byte ordering differences.
diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h
index ac1a159..cd37c59 100644
--- a/sys/nfs/nfsm_subs.h
+++ b/sys/nfs/nfsm_subs.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfsm_subs.h 8.1 (Berkeley) 6/16/93
+ * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_NFSM_SUBS_H_
#define _NFS_NFSM_SUBS_H_
diff --git a/sys/nfs/nfsmount.h b/sys/nfs/nfsmount.h
index ea48bca..1545ada 100644
--- a/sys/nfs/nfsmount.h
+++ b/sys/nfs/nfsmount.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfsmount.h 8.1 (Berkeley) 6/10/93
+ * @(#)nfsmount.h 8.3 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_NFSMOUNT_H_
#define _NFS_NFSMOUNT_H_
diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h
index 4408fe2..e52a3dd 100644
--- a/sys/nfs/nfsnode.h
+++ b/sys/nfs/nfsnode.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfsnode.h 8.4 (Berkeley) 2/13/94
+ * @(#)nfsnode.h 8.9 (Berkeley) 5/14/95
* $FreeBSD$
*/
+
#ifndef _NFS_NFSNODE_H_
#define _NFS_NFSNODE_H_
@@ -161,26 +162,16 @@ extern vop_t **spec_nfsv2nodeop_p;
* Prototypes for NFS vnode operations
*/
int nfs_write __P((struct vop_write_args *));
-#ifdef HAS_VOPLEASE
#define nfs_lease_check ((int (*) __P((struct vop_lease_args *)))nullop)
-#define nqnfs_vop_lease_check lease_check
-#else
-#ifdef __FreeBSD__
-#define nqnfs_lease_check nfs_lease_check
-#else
-#define nqnfs_lease_check lease_check
-#endif
-#endif
-#ifdef HAS_VOPREVOKE
+int nqnfs_vop_lease_check __P((struct vop_lease_args *));
#define nfs_revoke vop_revoke
-#endif
#define nfs_seek ((int (*) __P((struct vop_seek_args *)))nullop)
int nfs_abortop __P((struct vop_abortop_args *));
int nfs_inactive __P((struct vop_inactive_args *));
int nfs_reclaim __P((struct vop_reclaim_args *));
-int nfs_lock __P((struct vop_lock_args *));
-int nfs_unlock __P((struct vop_unlock_args *));
-int nfs_islocked __P((struct vop_islocked_args *));
+#define nfs_lock ((int (*) __P((struct vop_lock_args *)))vop_nolock)
+#define nfs_unlock ((int (*) __P((struct vop_unlock_args *)))vop_nounlock)
+#define nfs_islocked ((int (*) __P((struct vop_islocked_args *)))vop_noislocked)
#define nfs_reallocblks \
((int (*) __P((struct vop_reallocblks_args *)))eopnotsupp)
@@ -190,11 +181,7 @@ int nfs_nget __P((struct mount *,nfsfh_t *,int,struct nfsnode **));
nfsuint64 *nfs_getcookie __P((struct nfsnode *, off_t, int));
void nfs_invaldir __P((struct vnode *));
-#ifdef __FreeBSD__
#define nqnfs_lease_updatetime nfs_lease_updatetime
-#else
-#define nqnfs_lease_updatetime lease_updatetime
-#endif
#endif /* KERNEL */
diff --git a/sys/nfs/nfsrtt.h b/sys/nfs/nfsrtt.h
index 291427f..a67b6c9 100644
--- a/sys/nfs/nfsrtt.h
+++ b/sys/nfs/nfsrtt.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfsrtt.h 8.1 (Berkeley) 6/10/93
+ * @(#)nfsrtt.h 8.2 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_NFSRTT_H_
#define _NFS_NFSRTT_H_
diff --git a/sys/nfs/nfsrvcache.h b/sys/nfs/nfsrvcache.h
index 38c9657..2cfa694 100644
--- a/sys/nfs/nfsrvcache.h
+++ b/sys/nfs/nfsrvcache.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfsrvcache.h 8.1 (Berkeley) 6/10/93
+ * @(#)nfsrvcache.h 8.3 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_NFSRVCACHE_H_
#define _NFS_NFSRVCACHE_H_
diff --git a/sys/nfs/nqnfs.h b/sys/nfs/nqnfs.h
index af55a23..91942b2 100644
--- a/sys/nfs/nqnfs.h
+++ b/sys/nfs/nqnfs.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nqnfs.h 8.1 (Berkeley) 6/10/93
+ * @(#)nqnfs.h 8.3 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_NQNFS_H_
#define _NFS_NQNFS_H_
diff --git a/sys/nfs/rpcv2.h b/sys/nfs/rpcv2.h
index 418c80d..afe7972 100644
--- a/sys/nfs/rpcv2.h
+++ b/sys/nfs/rpcv2.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)rpcv2.h 8.1 (Berkeley) 6/10/93
+ * @(#)rpcv2.h 8.2 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_RPCV2_H_
#define _NFS_RPCV2_H_
diff --git a/sys/nfs/xdr_subs.h b/sys/nfs/xdr_subs.h
index 46016f2..cbaec88 100644
--- a/sys/nfs/xdr_subs.h
+++ b/sys/nfs/xdr_subs.h
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)xdr_subs.h 8.1 (Berkeley) 6/10/93
+ * @(#)xdr_subs.h 8.3 (Berkeley) 3/30/95
* $FreeBSD$
*/
+
#ifndef _NFS_XDR_SUBS_H_
#define _NFS_XDR_SUBS_H_
OpenPOWER on IntegriCloud