diff options
-rw-r--r-- | sys/nfs/nfs_bio.c | 22 | ||||
-rw-r--r-- | sys/nfs/nfs_node.c | 71 | ||||
-rw-r--r-- | sys/nfs/nfs_nqlease.c | 29 | ||||
-rw-r--r-- | sys/nfs/nfs_serv.c | 51 | ||||
-rw-r--r-- | sys/nfs/nfs_subs.c | 24 | ||||
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 4 | ||||
-rw-r--r-- | sys/nfs/nfs_var.h | 7 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 42 | ||||
-rw-r--r-- | sys/nfs/nfs_vnops.c | 34 | ||||
-rw-r--r-- | sys/nfs/nfsnode.h | 8 |
10 files changed, 56 insertions, 236 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 05105b20894..3fc3bf9843f 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_bio.c,v 1.10 1996/07/27 11:10:11 deraadt Exp $ */ +/* $OpenBSD: nfs_bio.c,v 1.11 1997/10/06 15:23:40 csapuntz Exp $ */ /* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */ /* @@ -740,16 +740,6 @@ nfs_asyncio(bp, cred) * is currently doing a write for this file and will pick up the * delayed writes before going back to sleep. */ - if (bp->b_flags & B_DELWRI) - TAILQ_REMOVE(&bdirties, bp, b_synclist); - TAILQ_INSERT_TAIL(&bdirties, bp, b_synclist); - bp->b_synctime = time.tv_sec + 30; - if (bdirties.tqh_first == bp) { - untimeout((void (*)__P((void *)))wakeup, - &bdirties); - timeout((void (*)__P((void *)))wakeup, - &bdirties, 30 * hz); - } bp->b_flags |= B_DELWRI; reassignbuf(bp, bp->b_vp); biodone(bp); @@ -910,16 +900,6 @@ nfs_doio(bp, cr, p) * B_DELWRI and B_NEEDCOMMIT flags. */ if (error == EINTR || (!error && (bp->b_flags & B_NEEDCOMMIT))) { - if (bp->b_flags & B_DELWRI) - TAILQ_REMOVE(&bdirties, bp, b_synclist); - TAILQ_INSERT_TAIL(&bdirties, bp, b_synclist); - bp->b_synctime = time.tv_sec + 30; - if (bdirties.tqh_first == bp) { - untimeout((void (*)__P((void *)))wakeup, - &bdirties); - timeout((void (*)__P((void *)))wakeup, - &bdirties, 30 * hz); - } bp->b_flags |= B_DELWRI; /* diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c index 27c551880d4..d5b8e9b15d0 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_node.c,v 1.7 1997/04/18 10:09:46 deraadt Exp $ */ +/* $OpenBSD: nfs_node.c,v 1.8 1997/10/06 15:23:41 csapuntz Exp $ */ /* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */ /* @@ -106,9 +106,7 @@ nfs_nget(mntp, fhp, fhsize, npp) int fhsize; struct nfsnode **npp; { -#ifdef Lite2_integrated struct proc *p = curproc; /* XXX */ -#endif register struct nfsnode *np; struct nfsnodehashhead *nhpp; register struct vnode *vp; @@ -123,11 +121,7 @@ loop: bcmp((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize)) continue; vp = NFSTOV(np); -#ifdef Lite2_integrated if (vget(vp, LK_EXCLUSIVE, p)) -#else - if (vget(vp, 1)) -#endif goto loop; *npp = np; return(0); @@ -162,9 +156,7 @@ nfs_inactive(v) { struct vop_inactive_args /* { struct vnode *a_vp; -#ifdef Lite2_integrated struct proc *a_p; -#endif } */ *ap = v; register struct nfsnode *np; register struct sillyrename *sp; @@ -191,9 +183,8 @@ nfs_inactive(v) } np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NQNFSEVICTED | NQNFSNONCACHE | NQNFSWRITE); -#ifdef Lite2_integrated + VOP_UNLOCK(ap->a_vp, 0, ap->a_p); -#endif return (0); } @@ -248,64 +239,6 @@ nfs_reclaim(v) return (0); } -#ifndef Lite2_integrated -/* - * Lock an nfsnode - */ -int -nfs_lock(v) - void *v; -{ - struct vop_lock_args /* { - struct vnode *a_vp; - } */ *ap = v; - register struct vnode *vp = ap->a_vp; - - /* - * Ugh, another place where interruptible mounts will get hung. - * If you make this sleep interruptible, then you have to fix all - * the VOP_LOCK() calls to expect interruptibility. - */ - while (vp->v_flag & VXLOCK) { - vp->v_flag |= VXWANT; - (void) tsleep((caddr_t)vp, PINOD, "nfslck", 0); - } - if (vp->v_tag == VT_NON) - return (ENOENT); - return (0); -} - -/* - * Unlock an nfsnode - */ -int -nfs_unlock(v) - void *v; -{ -#if 0 - struct vop_unlock_args /* { - struct vnode *a_vp; - } */ *ap = v; -#endif - return (0); -} - -/* - * Check for a locked nfsnode - */ -int -nfs_islocked(v) - void *v; -{ -#if 0 - struct vop_islocked_args /* { - struct vnode *a_vp; - } */ *ap = v; -#endif - return (0); -} -#endif /* Lite2_integrated */ - /* * Nfs abort op, called after namei() when a CREATE/DELETE isn't actually * done. Currently nothing to do. diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c index 778eda1d8f4..88c4b46ed76 100644 --- a/sys/nfs/nfs_nqlease.c +++ b/sys/nfs/nfs_nqlease.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_nqlease.c,v 1.9 1997/04/18 10:13:23 deraadt Exp $ */ +/* $OpenBSD: nfs_nqlease.c,v 1.10 1997/10/06 15:23:41 csapuntz Exp $ */ /* $NetBSD: nfs_nqlease.c,v 1.14 1996/02/18 14:06:50 fvdl Exp $ */ /* @@ -1048,11 +1048,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p) vp = NFSTOV(np); vpid = vp->v_id; if (np->n_expiry < time.tv_sec) { -#ifdef Lite2_integrated if (vget(vp, LK_EXCLUSIVE, p) == 0) { -#else - if (vget(vp, 1) == 0) { -#endif nmp->nm_inprog = vp; if (vpid == vp->v_id) { CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer); @@ -1079,11 +1075,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 && -#ifdef Lite2_integrated vget(vp, LK_EXCLUSIVE, p) == 0) { -#else - vget(vp, 1) == 0) { -#endif nmp->nm_inprog = vp; if (vpid == vp->v_id && nqnfs_getlease(vp, ND_WRITE, cred, p)==0) @@ -1188,10 +1180,8 @@ nqnfs_lease_updatetime(deltat) struct mount *mp; struct nfsmount *nmp; int s; -#ifdef Lite2_integrated struct proc *p = curproc; /* XXX */ struct mount *nxtmp; -#endif if (nqnfsstarttime != 0) nqnfsstarttime += deltat; @@ -1205,7 +1195,6 @@ nqnfs_lease_updatetime(deltat) * Search the mount list for all nqnfs mounts and do their timer * queues. */ -#ifdef Lite2_integrated simple_lock(&mountlist_slock); for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nxtmp) { if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) { @@ -1228,22 +1217,6 @@ nqnfs_lease_updatetime(deltat) vfs_unbusy(mp, p); } simple_unlock(&mountlist_slock); -#else /* Lite2_integrated */ - for (mp = mountlist.cqh_first; mp != (void *)&mountlist; - mp = mp->mnt_list.cqe_next) { - 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; - } - } - } - } -#endif } /* diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 17ad65c11cc..4d459c4e6ab 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.11 1997/04/18 09:22:45 deraadt Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.12 1997/10/06 15:23:42 csapuntz Exp $ */ /* $NetBSD: nfs_serv.c,v 1.25 1996/03/02 15:55:52 jtk Exp $ */ /* @@ -2453,15 +2453,8 @@ nfsrv_readdir(nfsd, slp, procp, mrq) nfsm_srvpostop_attr(getret, &at); return (0); } -#ifdef Lite2_integrated VOP_UNLOCK(vp, 0, procp); -#else - VOP_UNLOCK(vp); -#endif MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); - ncookies = siz / (5 * NFSX_UNSIGNED); /*7 for V3, but it's an est. so*/ - MALLOC(cookies, u_long *, ncookies * sizeof (u_long *), M_TEMP, - M_WAITOK); again: iv.iov_base = rbuf; iv.iov_len = fullsiz; @@ -2473,13 +2466,14 @@ again: io.uio_rw = UIO_READ; io.uio_procp = (struct proc *)0; eofflag = 0; -#ifdef Lite2_integrated - VOP_LOCK(vp, 0, procp); -#else - VOP_LOCK(vp); -#endif - error = VOP_READDIR(vp, &io, cred, &eofflag, cookies, ncookies); + if (cookies) { + free((caddr_t)cookies, M_TEMP); + cookies = NULL; + } + + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, procp); + error = VOP_READDIR(vp, &io, cred, &eofflag, &ncookies, &cookies); off = (off_t)io.uio_offset; if (!cookies && !error) @@ -2490,11 +2484,7 @@ again: error = getret; } -#ifdef Lite2_integrated VOP_UNLOCK(vp, 0, procp); -#else - VOP_UNLOCK(vp); -#endif if (error) { vrele(vp); free((caddr_t)rbuf, M_TEMP); @@ -2721,16 +2711,9 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq) nfsm_srvpostop_attr(getret, &at); return (0); } -#ifdef Lite2_integrated VOP_UNLOCK(vp, 0, procp); -#else - VOP_UNLOCK(vp); -#endif MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); - ncookies = siz / (7 * NFSX_UNSIGNED); - MALLOC(cookies, u_long *, ncookies * sizeof (u_long *), M_TEMP, - M_WAITOK); again: iv.iov_base = rbuf; iv.iov_len = fullsiz; @@ -2743,21 +2726,19 @@ again: io.uio_procp = (struct proc *)0; eofflag = 0; -#ifdef Lite2_integrated - VOP_LOCK(vp, 0, procp); -#else - VOP_LOCK(vp); -#endif - error = VOP_READDIR(vp, &io, cred, &eofflag, cookies, ncookies); + if (cookies) { + free((caddr_t)cookies, M_TEMP); + cookies = NULL; + } + + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, procp); + error = VOP_READDIR(vp, &io, cred, &eofflag, &ncookies, &cookies); off = (u_quad_t)io.uio_offset; getret = VOP_GETATTR(vp, &at, cred, procp); -#ifdef Lite2_integrated VOP_UNLOCK(vp, 0, procp); -#else - VOP_UNLOCK(vp); -#endif + if (!cookies && !error) error = NFSERR_PERM; if (!error) diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index e39e5657ed8..1506704ef11 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.19 1997/04/28 00:40:14 deraadt Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.20 1997/10/06 15:23:43 csapuntz Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -1144,8 +1144,9 @@ nfs_init() } #ifdef NFSCLIENT -void -nfs_vfs_init() +int +nfs_vfs_init(vfsp) + struct vfsconf *vfsp; { register int i; @@ -1154,6 +1155,8 @@ nfs_vfs_init() nfs_iodwant[i] = (struct proc *)0; TAILQ_INIT(&nfs_bufq); nfs_nhinit(); /* Init the nfsnode table */ + + return (0); } /* @@ -1247,10 +1250,9 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) * Since the nfsnode does not have a lock, its * vnode lock has to be carried over. */ -#ifdef Lite2_integrated + nvp->v_vnlock = vp->v_vnlock; vp->v_vnlock = NULL; -#endif nvp->v_data = vp->v_data; vp->v_data = NULL; vp->v_op = spec_vnodeop_p; @@ -1694,9 +1696,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag) int *rdonlyp; int kerbflag; { -#ifdef Lite2_integrated struct proc *p = curproc; /* XXX */ -#endif register struct mount *mp; register int i; struct ucred *credanon; @@ -1704,11 +1704,8 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag) struct sockaddr_in *saddr; *vpp = (struct vnode *)0; -#ifdef Lite2_integrated mp = vfs_getvfs(&fhp->fh_fsid); -#else - mp = getvfs(&fhp->fh_fsid); -#endif + if (!mp) return (ESTALE); error = VFS_FHTOVP(mp, &fhp->fh_fid, nam, vpp, &exflags, &credanon); @@ -1746,11 +1743,8 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag) else *rdonlyp = 0; if (!lockflag) -#ifdef Lite2_integrated VOP_UNLOCK(*vpp, 0, p); -#else - VOP_UNLOCK(*vpp); -#endif + return (0); } diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 68f33ff1f40..9ccb2b804c2 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.8 1997/03/30 20:02:32 mickey Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.9 1997/10/06 15:23:43 csapuntz Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -944,8 +944,6 @@ nfssvc_iod(p) * up to, but not including nfs_strategy(). */ if (nbp) { - if (nbp->b_flags & B_DELWRI) - TAILQ_REMOVE(&bdirties, nbp, b_synclist); nbp->b_flags &= ~(B_READ|B_DONE|B_ERROR|B_DELWRI); reassignbuf(nbp, nbp->b_vp); nbp->b_vp->v_numoutput++; diff --git a/sys/nfs/nfs_var.h b/sys/nfs/nfs_var.h index 8b7ac70f417..311f2a1f87b 100644 --- a/sys/nfs/nfs_var.h +++ b/sys/nfs/nfs_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_var.h,v 1.4 1996/12/14 15:36:51 deraadt Exp $ */ +/* $OpenBSD: nfs_var.h,v 1.5 1997/10/06 15:23:44 csapuntz Exp $ */ /* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */ /* @@ -80,9 +80,6 @@ u_long nfs_hash __P((nfsfh_t *, int)); int nfs_nget __P((struct mount *, nfsfh_t *, int, struct nfsnode **)); int nfs_inactive __P((void *)); int nfs_reclaim __P((void *)); -int nfs_lock __P((void *)); -int nfs_unlock __P((void *)); -int nfs_islocked __P((void *)); int nfs_abortop __P((void *)); /* nfs_vnops.c */ @@ -275,7 +272,7 @@ int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *)); int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *)); int nfs_adv __P((struct mbuf **, caddr_t *, int, int)); int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long)); -void nfs_vfs_init __P((void)); +int nfs_vfs_init __P((struct vfsconf *)); void nfs_init __P((void)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, struct vattr *)); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 596e5448624..ce71627558c 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.19 1997/04/18 10:15:20 deraadt Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.20 1997/10/06 15:23:45 csapuntz Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -72,16 +72,13 @@ extern struct nfsstats nfsstats; extern int nfs_ticks; -#ifdef notyet static int nfs_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *); -#endif /* * nfs vfs operations. */ struct vfsops nfs_vfsops = { - MOUNT_NFS, nfs_mount, nfs_start, nfs_unmount, @@ -93,9 +90,7 @@ struct vfsops nfs_vfsops = { nfs_fhtovp, nfs_vptofh, nfs_vfs_init, -#ifdef notyet nfs_sysctl -#endif }; extern u_int32_t nfs_procids[NFS_NPROCS]; @@ -180,7 +175,7 @@ nfs_statfs(mp, sbp, p) bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); } - strncpy(&sbp->f_fstypename[0], mp->mnt_op->vfs_name, MFSNAMELEN); + strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); nfsm_reqdone; vrele(vp); crfree(cred); @@ -294,20 +289,11 @@ nfs_mountroot() /* * Link it into the mount list. */ -#ifdef Lite2_integrated simple_lock(&mountlist_slock); CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); simple_unlock(&mountlist_slock); rootvp = vp; vfs_unbusy(mp, procp); -#else - if (vfs_lock(mp)) - panic("nfs_mountroot: vfs_lock"); - CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - mp->mnt_vnodecovered = NULLVP; - vfs_unlock(mp); - rootvp = vp; -#endif /* Get root attributes (for the time). */ error = VOP_GETATTR(vp, &attr, procp->p_ucred, procp); @@ -354,9 +340,7 @@ nfs_mountroot() */ nfs_boot_getfh(&nd.nd_boot, "swap", &nd.nd_swap); mp = nfs_mount_diskless(&nd.nd_swap, "/swap", 0, &vp); -#ifdef Lite2_integrated vfs_unbusy(mp, procp); -#endif printf("swap on %s\n", nd.nd_swap.ndm_host); /* @@ -397,16 +381,14 @@ nfs_mount_diskless(ndmntp, mntname, mntflag, vpp) struct mbuf *m; int error; -#ifdef Lite2_integrated vfs_rootmountalloc("nfs", mntname, &mp); -#else /* Create the mount point. */ mp = (struct mount *)malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK); if (mp == NULL) panic("nfs_mountroot: malloc mount for %s", mntname); bzero((char *)mp, (u_long)sizeof(struct mount)); -#endif + mp->mnt_op = &nfs_vfsops; mp->mnt_flag = mntflag; @@ -692,11 +674,8 @@ mountnfs(argp, mp, nam, pth, hst, vpp) mp->mnt_data = (qaddr_t)nmp; TAILQ_INIT(&nmp->nm_uidlruhead); } -#ifdef Lite2_integrated - vfs_getnewfsid(mp, makefstype(MOUNT_NFS)); -#else - getnewfsid(mp, makefstype(MOUNT_NFS)); -#endif + + vfs_getnewfsid(mp); nmp->nm_mountp = mp; if (argp->flags & NFSMNT_NQNFS) /* @@ -728,7 +707,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp) #else mp->mnt_stat.f_type = 0; #endif - strncpy(&mp->mnt_stat.f_fstypename[0], mp->mnt_op->vfs_name, MFSNAMELEN); + strncpy(&mp->mnt_stat.f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN); nmp->nm_nam = nam; @@ -903,13 +882,10 @@ loop: */ if (vp->v_mount != mp) goto loop; - if (VOP_ISLOCKED(vp) || vp->v_dirtyblkhd.lh_first == NULL) + if (VOP_ISLOCKED(vp) || vp->v_dirtyblkhd.lh_first == NULL || + waitfor == MNT_LAZY) continue; -#ifdef Lite2_integrated if (vget(vp, LK_EXCLUSIVE, p)) -#else - if (vget(vp, 1)) -#endif goto loop; error = VOP_FSYNC(vp, cred, waitfor, p); if (error) @@ -934,7 +910,6 @@ nfs_vget(mp, ino, vpp) return (EOPNOTSUPP); } -#ifdef notyet /* * Do that sysctl thang... */ @@ -977,7 +952,6 @@ nfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return EOPNOTSUPP; } } -#endif /* diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 7d009055598..6bc7ad11c12 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.15 1997/04/18 09:57:29 deraadt Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.16 1997/10/06 15:23:45 csapuntz Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -103,9 +103,7 @@ struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = { { &vop_lease_desc, nfs_lease_check }, /* lease */ { &vop_ioctl_desc, nfs_ioctl }, /* ioctl */ { &vop_select_desc, nfs_select }, /* select */ -#ifdef Lite2_integrated { &vop_revoke_desc, nfs_revoke }, /* revoke */ -#endif { &vop_mmap_desc, nfs_mmap }, /* mmap */ { &vop_fsync_desc, nfs_fsync }, /* fsync */ { &vop_seek_desc, nfs_seek }, /* seek */ @@ -159,9 +157,7 @@ struct vnodeopv_entry_desc spec_nfsv2nodeop_entries[] = { { &vop_lease_desc, spec_lease_check }, /* lease */ { &vop_ioctl_desc, spec_ioctl }, /* ioctl */ { &vop_select_desc, spec_select }, /* select */ -#ifdef Lite2_integrated { &vop_revoke_desc, spec_revoke }, /* revoke */ -#endif { &vop_mmap_desc, spec_mmap }, /* mmap */ { &vop_fsync_desc, nfs_fsync }, /* fsync */ { &vop_seek_desc, spec_seek }, /* seek */ @@ -213,9 +209,7 @@ struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = { { &vop_lease_desc, fifo_lease_check }, /* lease */ { &vop_ioctl_desc, fifo_ioctl }, /* ioctl */ { &vop_select_desc, fifo_select }, /* select */ -#ifdef Lite2_integrated { &vop_revoke_desc, fifo_revoke }, /* revoke */ -#endif { &vop_mmap_desc, fifo_mmap }, /* mmap */ { &vop_fsync_desc, nfs_fsync }, /* fsync */ { &vop_seek_desc, fifo_seek }, /* seek */ @@ -772,6 +766,7 @@ nfs_lookup(v) register struct componentname *cnp = ap->a_cnp; register struct vnode *dvp = ap->a_dvp; register struct vnode **vpp = ap->a_vpp; + struct proc *p = cnp->cn_proc; register int flags = cnp->cn_flags; register struct vnode *newvp; register u_int32_t *tl; @@ -810,11 +805,8 @@ nfs_lookup(v) VREF(newvp); error = 0; } else -#ifdef Lite2_integrated error = vget(newvp, LK_EXCLUSIVE, p); -#else - error = vget(newvp, 1); -#endif + if (!error) { if (vpid == newvp->v_id) { if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, cnp->cn_proc) @@ -1964,11 +1956,17 @@ nfs_readdir(v) if (!error && ap->a_cookies) { struct dirent *dp; - u_long *cookies = ap->a_cookies; - int ncookies = ap->a_ncookies; + u_long *cookies; + /* XXX - over-estimate - see UFS code for how to do it + right */ + int ncookies = (uio->uio_iov->iov_base - base) / 12; - /* - * Only the NFS server and emulations use cookies, and they + MALLOC(cookies, u_long *, sizeof(*cookies) * ncookies, + M_TEMP, M_WAITOK); + *ap->a_ncookies = ncookies; + *ap->a_cookies = cookies; + + /* Only the NFS server and emulations use cookies, and they * load the directory block into system space, so we can * just look at it directly. */ @@ -1982,6 +1980,8 @@ nfs_readdir(v) *(cookies++) = off; base += dp->d_reclen; } + + *ap->a_ncookies -= ncookies; uio->uio_resid += (uio->uio_iov->iov_base - base); uio->uio_iov->iov_len += (uio->uio_iov->iov_base - base); uio->uio_iov->iov_base = base; @@ -2812,8 +2812,6 @@ again: else { vp->v_numoutput++; bp->b_flags |= B_ASYNC; - if (bp->b_flags & B_DELWRI) - TAILQ_REMOVE(&bdirties, bp, b_synclist); bp->b_flags &= ~(B_READ|B_DONE|B_ERROR|B_DELWRI); bp->b_dirtyoff = bp->b_dirtyend = 0; reassignbuf(bp, vp); @@ -3092,8 +3090,6 @@ nfs_writebp(bp, force) bp, bp->b_vp, bp->b_validoff, bp->b_validend, bp->b_dirtyoff, bp->b_dirtyend); #endif - if (bp->b_flags & B_DELWRI) - TAILQ_REMOVE(&bdirties, bp, b_synclist); bp->b_flags &= ~(B_READ|B_DONE|B_ERROR|B_DELWRI); if (oldflags & B_ASYNC) { diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h index 8ca127a4e6a..b6255b0bbf9 100644 --- a/sys/nfs/nfsnode.h +++ b/sys/nfs/nfsnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsnode.h,v 1.3 1996/03/31 13:16:16 mickey Exp $ */ +/* $OpenBSD: nfsnode.h,v 1.4 1997/10/06 15:23:46 csapuntz Exp $ */ /* $NetBSD: nfsnode.h,v 1.16 1996/02/18 11:54:04 fvdl Exp $ */ /* @@ -191,15 +191,9 @@ int nfs_readlink __P((void *)); int nfs_abortop __P((void *)); int nfs_inactive __P((void *)); int nfs_reclaim __P((void *)); -#ifdef Lite2_integrated #define nfs_lock ((int (*) __P((void *)))vop_nolock) #define nfs_unlock ((int (*) __P((void *)))vop_nounlock) #define nfs_islocked ((int (*) __P((void *)))vop_noislocked) -#else -int nfs_lock __P((void *)); -int nfs_unlock __P((void *)); -int nfs_islocked __P((void *)); -#endif /* Lite2_integrated */ int nfs_bmap __P((void *)); int nfs_strategy __P((void *)); int nfs_print __P((void *)); |