diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2005-03-13 12:18:25 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2005-03-13 12:18:25 +0000 |
commit | 8da004659614776a1870c098b23c99158c298904 (patch) | |
tree | aa27ba510f7c723270e0278e561283b717a36c7b /sys/fs | |
parent | dcc18814bade0716e14ae53962af78719ef9fc17 (diff) | |
download | src-8da004659614776a1870c098b23c99158c298904.tar.gz src-8da004659614776a1870c098b23c99158c298904.zip |
- The VI_DOOMED flag now signals the end of a vnode's relationship with
the filesystem. Check that rather than VI_XLOCK.
- VOP_INACTIVE should no longer drop the vnode lock.
- The vnode lock is required around calls to vrecycle() and vgone().
Sponsored by: Isilon Systems, Inc.
Notes
Notes:
svn path=/head/; revision=143513
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/fdescfs/fdesc_vnops.c | 1 | ||||
-rw-r--r-- | sys/fs/fifofs/fifo_vnops.c | 4 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_denode.c | 1 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 2 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/fs/nullfs/null_subr.c | 4 | ||||
-rw-r--r-- | sys/fs/nullfs/null_vnops.c | 16 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_io.c | 2 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_node.c | 1 | ||||
-rw-r--r-- | sys/fs/pseudofs/pseudofs_vncache.c | 4 | ||||
-rw-r--r-- | sys/fs/smbfs/smbfs_io.c | 2 | ||||
-rw-r--r-- | sys/fs/smbfs/smbfs_node.c | 3 | ||||
-rw-r--r-- | sys/fs/smbfs/smbfs_vnops.c | 15 | ||||
-rw-r--r-- | sys/fs/umapfs/umap_vnops.c | 1 | ||||
-rw-r--r-- | sys/fs/unionfs/union_vnops.c | 3 |
16 files changed, 17 insertions, 46 deletions
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index c3d0ef655ec3..613442664a66 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -498,7 +498,6 @@ fdesc_inactive(ap) * Clear out the v_type field to avoid * nasty things happening in vgone(). */ - VOP_UNLOCK(vp, 0, ap->a_td); vp->v_type = VNON; return (0); } diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index fba7d10da46c..36e7478cdab9 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -447,11 +447,8 @@ fifo_close(ap) } */ *ap; { struct vnode *vp = ap->a_vp; - struct thread *td = ap->a_td; struct fifoinfo *fip = vp->v_fifoinfo; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); - if (ap->a_fflag & FREAD) { fip->fi_readers--; if (fip->fi_readers == 0) @@ -463,7 +460,6 @@ fifo_close(ap) socantrcvmore(fip->fi_readsock); } fifo_cleanup(vp); - VOP_UNLOCK(vp, 0, td); return (0); } diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index 78cf78ab6b85..ce6b96500570 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -578,12 +578,10 @@ hpfs_inactive(ap) vprint("hpfs_inactive: pushing active", vp); if (hp->h_flag & H_INVAL) { - VOP_UNLOCK(vp,0,ap->a_td); vrecycle(vp, ap->a_td); return (0); } - VOP_UNLOCK(vp,0,ap->a_td); return (0); } diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 283b070f52d0..247b00f1d1c9 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -695,7 +695,6 @@ msdosfs_inactive(ap) deupdat(dep, 0); out: - VOP_UNLOCK(vp, 0, td); /* * If we are done with the denode, reclaim it * so that it can be reused immediately. diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 727481a4b294..5d1a194bee43 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -872,7 +872,7 @@ msdosfs_sync(mp, waitfor, td) loop: MNT_VNODE_FOREACH(vp, mp, nvp) { VI_LOCK(vp); - if (vp->v_type == VNON || (vp->v_iflag & VI_XLOCK)) { + if (vp->v_type == VNON || (vp->v_iflag & VI_DOOMED)) { VI_UNLOCK(vp); continue; } diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index 419eb6ba1203..1c0a0bb46d62 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -223,8 +223,6 @@ ntfs_inactive(ap) if (ntfs_prtactive && vrefcnt(vp) != 0) vprint("ntfs_inactive: pushing active", vp); - VOP_UNLOCK(vp, 0, ap->a_td); - /* XXX since we don't support any filesystem changes * right now, nothing more needs to be done */ diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index ac54c21cb62e..f6543b2ec452 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -128,7 +128,7 @@ loop: * recycling the nullfs vnode or another thread * in vrele() waiting for the vnode lock. */ - if ((vp->v_iflag & VI_XLOCK) != 0) { + if ((vp->v_iflag & VI_DOOMED) != 0) { VI_UNLOCK(vp); continue; } @@ -177,7 +177,7 @@ loop: * recycling the nullfs vnode or another thread * in vrele() waiting for the vnode lock. */ - if ((ovp->v_iflag & VI_XLOCK) != 0) { + if ((ovp->v_iflag & VI_DOOMED) != 0) { VI_UNLOCK(ovp); continue; } diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index f02adbc5d785..bee46eec6c1d 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -537,6 +537,10 @@ null_lock(struct vop_lock_args *ap) return (error); } + if ((flags & LK_INTERLOCK) == 0) { + VI_LOCK(vp); + flags |= LK_INTERLOCK; + } if (vp->v_vnlock != NULL) { /* * The lower level has exported a struct lock to us. Use @@ -546,10 +550,6 @@ null_lock(struct vop_lock_args *ap) * going away doesn't mean the struct lock below us is. * LK_EXCLUSIVE is fine. */ - if ((flags & LK_INTERLOCK) == 0) { - VI_LOCK(vp); - flags |= LK_INTERLOCK; - } nn = VTONULL(vp); if ((flags & LK_TYPE_MASK) == LK_DRAIN) { NULLFSDEBUG("null_lock: avoiding LK_DRAIN\n"); @@ -558,7 +558,7 @@ null_lock(struct vop_lock_args *ap) * pending locks to complete. Afterwards the * lockmgr call might block, but no other threads * will attempt to use this nullfs vnode due to the - * VI_XLOCK flag. + * VI_DOOMED flag. */ while (nn->null_pending_locks > 0) { nn->null_drain_wakeup = 1; @@ -580,7 +580,7 @@ null_lock(struct vop_lock_args *ap) * and another process might have initiated a recycle * operation. When that happens, just back out. */ - if (error == 0 && (vp->v_iflag & VI_XLOCK) != 0 && + if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0 && td != vp->v_vxthread) { lockmgr(vp->v_vnlock, (flags & ~LK_TYPE_MASK) | LK_RELEASE, @@ -598,9 +598,6 @@ null_lock(struct vop_lock_args *ap) nn->null_drain_wakeup = 0; wakeup(&nn->null_pending_locks); } - if (error == ENOENT && (vp->v_iflag & VI_XLOCK) != 0 && - vp->v_vxthread != curthread) - vx_waitl(vp); VI_UNLOCK(vp); return error; } else { @@ -695,7 +692,6 @@ null_inactive(struct vop_inactive_args *ap) struct thread *td = ap->a_td; vp->v_object = NULL; - VOP_UNLOCK(vp, 0, td); /* * If this is the last reference, then free up the vnode diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c index 9aa26c3586e3..0b697560ccd9 100644 --- a/sys/fs/nwfs/nwfs_io.c +++ b/sys/fs/nwfs/nwfs_io.c @@ -600,7 +600,7 @@ nwfs_vinvalbuf(vp, td) /* struct nwmount *nmp = VTONWFS(vp);*/ int error = 0; - if (vp->v_iflag & VI_XLOCK) + if (vp->v_iflag & VI_DOOMED) return (0); while (np->n_flag & NFLUSHINPROG) { diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c index 026d74ca3151..29ce5d3ac9f0 100644 --- a/sys/fs/nwfs/nwfs_node.c +++ b/sys/fs/nwfs/nwfs_node.c @@ -297,7 +297,6 @@ nwfs_inactive(ap) error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh, td, cred); np->opened = 0; } - VOP_UNLOCK(vp, 0, td); if (np->n_flag & NSHOULDFREE) { cache_purge(vp); vgone(vp); diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index 391490878482..ddbdb3499b82 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -248,7 +248,9 @@ pfs_exit(void *arg, struct proc *p) if (pvd->pvd_pid == p->p_pid) { vnp = pvd->pvd_vnode; mtx_unlock(&pfs_vncache_mutex); + VOP_LOCK(vnp, LK_EXCLUSIVE, curthread); vgone(vnp); + VOP_UNLOCK(vnp, 0, curthread); mtx_lock(&pfs_vncache_mutex); pvd = pfs_vncache; } else { @@ -278,7 +280,9 @@ pfs_disable(struct pfs_node *pn) if (pvd->pvd_pn == pn) { vnp = pvd->pvd_vnode; mtx_unlock(&pfs_vncache_mutex); + VOP_LOCK(vnp, LK_EXCLUSIVE, curthread); vgone(vnp); + VOP_UNLOCK(vnp, 0, curthread); mtx_lock(&pfs_vncache_mutex); pvd = pfs_vncache; } else { diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index ef1870979045..a5161945c923 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -672,7 +672,7 @@ smbfs_vinvalbuf(struct vnode *vp, struct thread *td) struct smbnode *np = VTOSMB(vp); int error = 0; - if (vp->v_iflag & VI_XLOCK) + if (vp->v_iflag & VI_DOOMED) return 0; while (np->n_flag & NFLUSHINPROG) { diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c index e3d2f3b1b452..7ad977b2c758 100644 --- a/sys/fs/smbfs/smbfs_node.c +++ b/sys/fs/smbfs/smbfs_node.c @@ -220,8 +220,8 @@ loop: */ if ((vp->v_type == VDIR && (np->n_dosattr & SMB_FA_DIR) == 0) || (vp->v_type == VREG && (np->n_dosattr & SMB_FA_DIR) != 0)) { - vput(vp); vgone(vp); + vput(vp); break; } *vpp = vp; @@ -377,7 +377,6 @@ smbfs_inactive(ap) np->n_flag &= ~NOPEN; smbfs_attr_cacheremove(vp); } - VOP_UNLOCK(vp, 0, td); if (np->n_flag & NGONE) vrecycle(vp, td); return (0); diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 6125b893d0c1..9b27a527bcf1 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -220,10 +220,6 @@ smbfs_open(ap) return error; } -/* - * XXX: VOP_CLOSE() usually called without lock held which is suck. Here we - * do some heruistic to determine if vnode should be locked. - */ static int smbfs_close(ap) struct vop_close_args /* { @@ -238,22 +234,13 @@ smbfs_close(ap) struct thread *td = ap->a_td; struct smbnode *np = VTOSMB(vp); struct smb_cred scred; - int dolock; - VI_LOCK(vp); - dolock = (vp->v_iflag & VI_XLOCK) == 0; - if (dolock) - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | LK_INTERLOCK, td); - else - VI_UNLOCK(vp); if (vp->v_type == VDIR && (np->n_flag & NOPEN) != 0 && np->n_dirseq != NULL) { smb_makescred(&scred, td, ap->a_cred); smbfs_findclose(np->n_dirseq, &scred); np->n_dirseq = NULL; } - if (dolock) - VOP_UNLOCK(vp, 0, td); return 0; } @@ -1187,9 +1174,9 @@ smbfs_lookup(ap) return (0); } cache_purge(vp); - vput(vp); if (killit) vgone(vp); + vput(vp); if (lockparent && dvp != vp && islastcn) VOP_UNLOCK(dvp, 0, td); } diff --git a/sys/fs/umapfs/umap_vnops.c b/sys/fs/umapfs/umap_vnops.c index 7ce5b26a3fa9..92a3bc480612 100644 --- a/sys/fs/umapfs/umap_vnops.c +++ b/sys/fs/umapfs/umap_vnops.c @@ -411,7 +411,6 @@ umap_inactive(ap) * */ VOP_INACTIVE(lowervp, ap->a_td); - VOP_UNLOCK(ap->a_vp, 0, ap->a_td); return (0); } diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 7e986235037c..7aef07c8549e 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -1650,7 +1650,6 @@ union_inactive(ap) } */ *ap; { struct vnode *vp = ap->a_vp; - struct thread *td = ap->a_td; struct union_node *un = VTOUNION(vp); /* @@ -1671,8 +1670,6 @@ union_inactive(ap) } #endif - VOP_UNLOCK(vp, 0, td); - if ((un->un_flags & UN_CACHED) == 0) vgone(vp); |