diff options
author | jeff <jeff@FreeBSD.org> | 2002-08-04 10:29:36 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-08-04 10:29:36 +0000 |
commit | 02517b6731ab2da44ce9b49260429744cf0114d5 (patch) | |
tree | e889f56910bf98cbee3be239655a9e4bbb928b2e /sys/nfsclient | |
parent | a03ca02ee99a255a2c14a75ff8eb488960b13ea7 (diff) | |
download | FreeBSD-src-02517b6731ab2da44ce9b49260429744cf0114d5.zip FreeBSD-src-02517b6731ab2da44ce9b49260429744cf0114d5.tar.gz |
- Replace v_flag with v_iflag and v_vflag
- v_vflag is protected by the vnode lock and is used when synchronization
with VOP calls is needed.
- v_iflag is protected by interlock and is used for dealing with vnode
management issues. These flags include X/O LOCK, FREE, DOOMED, etc.
- All accesses to v_iflag and v_vflag have either been locked or marked with
mp_fixme's.
- Many ASSERT_VOP_LOCKED calls have been added where the locking was not
clear.
- Many functions in vfs_subr.c were restructured to provide for stronger
locking.
Idea stolen from: BSD/OS
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs_bio.c | 9 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 5 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 6 |
3 files changed, 14 insertions, 6 deletions
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 685c6d1..d8243ae 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -1063,9 +1063,13 @@ nfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, struct nfsmount *nmp = VFSTONFS(vp->v_mount); int error = 0, slpflag, slptimeo; - if (vp->v_flag & VXLOCK) { + VI_LOCK(vp); + if (vp->v_iflag & VI_XLOCK) { + /* XXX Should we wait here? */ + VI_UNLOCK(vp); return (0); } + VI_UNLOCK(vp); if ((nmp->nm_flag & NFSMNT_INT) == 0) intrflg = 0; @@ -1340,7 +1344,8 @@ nfs_doio(struct buf *bp, struct ucred *cr, struct thread *td) uiop->uio_resid = 0; } } - if (p && (vp->v_flag & VTEXT) && + mp_fixme("Accessing VV_TEXT without a lock."); + if (p && (vp->v_vflag & VV_TEXT) && (np->n_mtime != np->n_vattr.va_mtime.tv_sec)) { uprintf("Process killed due to text file modification\n"); PROC_LOCK(p); diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 45ad218..4ac930e 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -505,7 +505,8 @@ nfs_mountroot(struct mount *mp, struct thread *td) * hack it to a regular file. */ vp->v_type = VREG; - vp->v_flag = 0; + vp->v_vflag = 0; + vp->v_iflag = 0; VREF(vp); swaponvp(td, vp, NODEV, nd->swap_nblks); } @@ -951,7 +952,7 @@ nfs_root(struct mount *mp, struct vnode **vpp) vp = NFSTOV(np); if (vp->v_type == VNON) vp->v_type = VDIR; - vp->v_flag = VROOT; + vp->v_vflag |= VV_ROOT; *vpp = vp; return (0); } diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index a2aa645..37b9264 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2807,9 +2807,10 @@ loop: goto again; } if (waitfor == MNT_WAIT) { + VI_LOCK(vp); while (vp->v_numoutput) { - vp->v_flag |= VBWAIT; - error = tsleep((caddr_t)&vp->v_numoutput, + vp->v_iflag |= VI_BWAIT; + error = msleep((caddr_t)&vp->v_numoutput, VI_MTX(vp), slpflag | (PRIBIO + 1), "nfsfsync", slptimeo); if (error) { if (nfs_sigintr(nmp, NULL, td)) { @@ -2822,6 +2823,7 @@ loop: } } } + VI_UNLOCK(vp); if (!TAILQ_EMPTY(&vp->v_dirtyblkhd) && commit) { goto loop; } |