Index: share/man/man9/vnodeops.9 =================================================================== RCS file: /cvsroot/src/share/man/man9/vnodeops.9,v retrieving revision 1.92 diff -p -u -4 -r1.92 vnodeops.9 --- share/man/man9/vnodeops.9 7 Feb 2014 15:29:21 -0000 1.92 +++ share/man/man9/vnodeops.9 25 Feb 2014 11:52:52 -0000 @@ -1070,8 +1070,13 @@ If .Fa flags contains .Dv LK_NOWAIT and the lock is busy, the operation will return immediately with an error code. +If +.Fa flags +contains +.Dv LK_RETRY +this is a hint the caller wants the lock on dead vnodes too. If the operation is successful zero is returned, otherwise an appropriate error code is returned. .Fn VOP_LOCK is used to serialize access to the file system such as to prevent two Index: share/man/man9/vnsubr.9 =================================================================== RCS file: /cvsroot/src/share/man/man9/vnsubr.9,v retrieving revision 1.41 diff -p -u -4 -r1.41 vnsubr.9 --- share/man/man9/vnsubr.9 30 Jan 2011 07:04:48 -0000 1.41 +++ share/man/man9/vnsubr.9 25 Feb 2014 11:52:56 -0000 @@ -137,16 +137,13 @@ shared lock exclusive lock .It LK_NOWAIT do not sleep to await lock .It LK_RETRY -retry lock operation until locked +allow lock operation on dead vnode .El .Pp If the operation is successful zero is returned, otherwise an appropriate error code is returned. -The vnode interlock -.Em v_interlock -is released on return. .Pp .Fn vn_lock must not be called when the vnode's reference count is zero. Instead, Index: sys/kern/vfs_vnode.c =================================================================== RCS file: /cvsroot/src/sys/kern/vfs_vnode.c,v retrieving revision 1.30 diff -p -u -4 -r1.30 vfs_vnode.c --- sys/kern/vfs_vnode.c 7 Dec 2013 10:03:28 -0000 1.30 +++ sys/kern/vfs_vnode.c 25 Feb 2014 11:53:03 -0000 @@ -635,30 +635,19 @@ vrelel(vnode_t *vp, int flags) /* * We have to try harder. */ mutex_exit(vp->v_interlock); - error = VOP_LOCK(vp, LK_EXCLUSIVE); + error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); KASSERT(error == 0); mutex_enter(vp->v_interlock); - /* - * If the node got another reference while sleeping, - * don't try to inactivate it yet. - */ - if (__predict_false(vtryrele(vp))) { - VOP_UNLOCK(vp); - if ((flags & VRELEL_CHANGING_SET) != 0) { - KASSERT((vp->v_iflag & VI_CHANGING) != 0); - vp->v_iflag &= ~VI_CHANGING; - cv_broadcast(&vp->v_cv); - } - mutex_exit(vp->v_interlock); - return; - } defer = false; } else { /* If we can't acquire the lock, then defer. */ - error = VOP_LOCK(vp, LK_EXCLUSIVE | LK_NOWAIT); + mutex_exit(vp->v_interlock); + error = vn_lock(vp, + LK_EXCLUSIVE | LK_RETRY | LK_NOWAIT); defer = (error != 0); + mutex_enter(vp->v_interlock); } KASSERT(mutex_owned(vp->v_interlock)); KASSERT(! (curlwp == vrele_lwp && defer)); @@ -681,8 +670,23 @@ vrelel(vnode_t *vp, int flags) mutex_exit(vp->v_interlock); return; } + /* + * If the node got another reference while we + * released the interlock, don't try to inactivate it yet. + */ + if (__predict_false(vtryrele(vp))) { + VOP_UNLOCK(vp); + if ((flags & VRELEL_CHANGING_SET) != 0) { + KASSERT((vp->v_iflag & VI_CHANGING) != 0); + vp->v_iflag &= ~VI_CHANGING; + cv_broadcast(&vp->v_cv); + } + mutex_exit(vp->v_interlock); + return; + } + if ((flags & VRELEL_CHANGING_SET) == 0) { KASSERT((vp->v_iflag & VI_CHANGING) == 0); vp->v_iflag |= VI_CHANGING; } @@ -923,37 +927,33 @@ vclean(vnode_t *vp) KASSERT(mutex_owned(vp->v_interlock)); KASSERT((vp->v_iflag & VI_MARKER) == 0); KASSERT(vp->v_usecount != 0); - /* If cleaning is already in progress wait until done and return. */ - if (vp->v_iflag & VI_XLOCK) { - vwait(vp, VI_XLOCK); - return; - } - /* If already clean, nothing to do. */ if ((vp->v_iflag & VI_CLEAN) != 0) { return; } + active = (vp->v_usecount > 1); + doclose = ! (active && vp->v_type == VBLK && + spec_node_getmountedfs(vp) != NULL); + mutex_exit(vp->v_interlock); + + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + /* * Prevent the vnode from being recycled or brought into use * while we clean it out. */ + mutex_enter(vp->v_interlock); + KASSERT((vp->v_iflag & (VI_XLOCK | VI_CLEAN)) == 0); vp->v_iflag |= VI_XLOCK; if (vp->v_iflag & VI_EXECMAP) { atomic_add_int(&uvmexp.execpages, -vp->v_uobj.uo_npages); atomic_add_int(&uvmexp.filepages, vp->v_uobj.uo_npages); } vp->v_iflag &= ~(VI_TEXT|VI_EXECMAP); - active = (vp->v_usecount > 1); - - /* XXXAD should not lock vnode under layer */ mutex_exit(vp->v_interlock); - VOP_LOCK(vp, LK_EXCLUSIVE); - - doclose = ! (active && vp->v_type == VBLK && - spec_node_getmountedfs(vp) != NULL); /* * Clean out any cached data associated with the vnode. * If purging an active vnode, it must be closed and Index: sys/kern/vfs_vnops.c =================================================================== RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v retrieving revision 1.188 diff -p -u -4 -r1.188 vfs_vnops.c --- sys/kern/vfs_vnops.c 23 Jan 2014 10:13:57 -0000 1.188 +++ sys/kern/vfs_vnops.c 25 Feb 2014 11:53:06 -0000 @@ -791,30 +791,16 @@ vn_lock(struct vnode *vp, int flags) if (wapbl_vphaswapbl(vp)) WAPBL_JUNLOCK_ASSERT(wapbl_vptomp(vp)); #endif - do { - /* - * XXX PR 37706 forced unmount of file systems is unsafe. - * Race between vclean() and this the remaining problem. - */ - mutex_enter(vp->v_interlock); - if (vp->v_iflag & VI_XLOCK) { - if (flags & LK_NOWAIT) { - mutex_exit(vp->v_interlock); - return EBUSY; - } - vwait(vp, VI_XLOCK); - mutex_exit(vp->v_interlock); - error = ENOENT; - } else { - mutex_exit(vp->v_interlock); - error = VOP_LOCK(vp, (flags & ~LK_RETRY)); - if (error == 0 || error == EDEADLK || error == EBUSY) - return (error); - } - } while (flags & LK_RETRY); - return (error); + error = VOP_LOCK(vp, flags); + if ((flags & LK_RETRY) != 0 && error == ENOENT) + error = VOP_LOCK(vp, flags); + + KASSERT((flags & LK_RETRY) == 0 || (flags & LK_NOWAIT) != 0 || + error == 0); + + return error; } /* * File table vnode close routine. Index: sys/miscfs/genfs/genfs.h =================================================================== RCS file: /cvsroot/src/sys/miscfs/genfs/genfs.h,v retrieving revision 1.31 diff -p -u -4 -r1.31 genfs.h --- sys/miscfs/genfs/genfs.h 2 May 2013 14:49:51 -0000 1.31 +++ sys/miscfs/genfs/genfs.h 25 Feb 2014 11:53:09 -0000 @@ -19,8 +19,12 @@ int genfs_ebadf(void *); int genfs_nolock(void *); int genfs_noislocked(void *); int genfs_nounlock(void *); +int genfs_deadlock(void *); +#define genfs_deadislocked genfs_islocked +int genfs_deadunlock(void *); + int genfs_poll(void *); int genfs_kqfilter(void *); int genfs_fcntl(void *); int genfs_seek(void *); Index: sys/miscfs/genfs/genfs_vnops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/genfs/genfs_vnops.c,v retrieving revision 1.189 diff -p -u -4 -r1.189 genfs_vnops.c --- sys/miscfs/genfs/genfs_vnops.c 30 Mar 2012 18:24:08 -0000 1.189 +++ sys/miscfs/genfs/genfs_vnops.c 25 Feb 2014 11:53:13 -0000 @@ -277,8 +277,67 @@ genfs_revoke(void *v) return (0); } /* + * Lock the node (for deadfs). + */ +int +genfs_deadlock(void *v) +{ + struct vop_lock_args /* { + struct vnode *a_vp; + int a_flags; + } */ *ap = v; + struct vnode *vp = ap->a_vp; + int flags = ap->a_flags; + krw_t op; + + if ((flags & LK_NOWAIT) != 0) { + if (!mutex_tryenter(vp->v_interlock)) + return EBUSY; + if ((vp->v_iflag & VI_XLOCK)) { + mutex_exit(vp->v_interlock); + return EBUSY; + } + } + + mutex_enter(vp->v_interlock); + if ((vp->v_iflag & VI_XLOCK)) + vwait(vp, VI_XLOCK); + mutex_exit(vp->v_interlock); + + if ((flags & LK_RETRY) == 0) + return ENOENT; + + op = ((flags & LK_EXCLUSIVE) != 0 ? RW_WRITER : RW_READER); + if ((flags & LK_NOWAIT) != 0) { + if (! rw_tryenter(&vp->v_lock, op)) + return EBUSY; + return 0; + } + + rw_enter(&vp->v_lock, op); + + return 0; +} + +/* + * Unlock the node (for deadfs). + */ +int +genfs_deadunlock(void *v) +{ + struct vop_unlock_args /* { + struct vnode *a_vp; + } */ *ap = v; + struct vnode *vp = ap->a_vp; + + rw_exit(&vp->v_lock); + + return 0; +} + +/* * Lock the node. */ int genfs_lock(void *v) @@ -287,27 +346,44 @@ genfs_lock(void *v) struct vnode *a_vp; int a_flags; } */ *ap = v; struct vnode *vp = ap->a_vp; + struct mount *mp = vp->v_mount; int flags = ap->a_flags; krw_t op; - KASSERT((flags & ~(LK_EXCLUSIVE | LK_SHARED | LK_NOWAIT)) == 0); - op = ((flags & LK_EXCLUSIVE) != 0 ? RW_WRITER : RW_READER); if ((flags & LK_NOWAIT) != 0) { - if (fstrans_start_nowait(vp->v_mount, FSTRANS_SHARED)) + if (!mutex_tryenter(vp->v_interlock)) + return EBUSY; + if ((vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) { + mutex_exit(vp->v_interlock); + return EBUSY; + } + mutex_exit(vp->v_interlock); + if (fstrans_start_nowait(mp, FSTRANS_SHARED)) return EBUSY; if (! rw_tryenter(&vp->v_lock, op)) { - fstrans_done(vp->v_mount); + fstrans_done(mp); return EBUSY; } return 0; } - fstrans_start(vp->v_mount, FSTRANS_SHARED); + fstrans_start(mp, FSTRANS_SHARED); rw_enter(&vp->v_lock, op); + mutex_enter(vp->v_interlock); + if ((vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) { + rw_exit(&vp->v_lock); + fstrans_done(mp); + if ((vp->v_iflag & VI_XLOCK)) + vwait(vp, VI_XLOCK); + mutex_exit(vp->v_interlock); + return ENOENT; + } + mutex_exit(vp->v_interlock); + return 0; } /* Index: sys/miscfs/genfs/layer_extern.h =================================================================== RCS file: /cvsroot/src/sys/miscfs/genfs/layer_extern.h,v retrieving revision 1.34 diff -p -u -4 -r1.34 layer_extern.h --- sys/miscfs/genfs/layer_extern.h 1 Feb 2012 05:34:42 -0000 1.34 +++ sys/miscfs/genfs/layer_extern.h 25 Feb 2014 11:53:16 -0000 @@ -102,8 +102,9 @@ void layerfs_renamelock_exit(struct moun int layer_bypass(void *); int layer_getattr(void *); int layer_inactive(void *); int layer_reclaim(void *); +int layer_lock(void *); int layer_print(void *); int layer_bmap(void *); int layer_fsync(void *); int layer_lookup(void *); Index: sys/miscfs/genfs/layer_vnops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/genfs/layer_vnops.c,v retrieving revision 1.54 diff -p -u -4 -r1.54 layer_vnops.c --- sys/miscfs/genfs/layer_vnops.c 7 Feb 2014 15:29:22 -0000 1.54 +++ sys/miscfs/genfs/layer_vnops.c 25 Feb 2014 11:53:19 -0000 @@ -705,8 +705,48 @@ layer_reclaim(void *v) return 0; } +int +layer_lock(void *v) +{ + struct vop_lock_args /* { + struct vnode *a_vp; + int a_flags; + } */ *ap = v; + struct vnode *vp = ap->a_vp; + struct vnode *lowervp = LAYERVPTOLOWERVP(vp); + int flags = ap->a_flags; + int error; + + if ((flags & LK_NOWAIT) != 0) { + if (!mutex_tryenter(vp->v_interlock)) + return EBUSY; + if ((vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) { + mutex_exit(vp->v_interlock); + return EBUSY; + } + mutex_exit(vp->v_interlock); + return VOP_LOCK(lowervp, flags); + } + + error = VOP_LOCK(lowervp, flags); + if (error) + return error; + + mutex_enter(vp->v_interlock); + if ((vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) { + VOP_UNLOCK(lowervp); + if ((vp->v_iflag & VI_XLOCK)) + vwait(vp, VI_XLOCK); + mutex_exit(vp->v_interlock); + return ENOENT; + } + mutex_exit(vp->v_interlock); + + return 0; +} + /* * We just feed the returned vnode up to the caller - there's no need * to build a layer node on top of the node on which we're going to do * i/o. :-) Index: sys/fs/union/union_vnops.c =================================================================== RCS file: /cvsroot/src/sys/fs/union/union_vnops.c,v retrieving revision 1.56 diff -p -u -4 -r1.56 union_vnops.c --- sys/fs/union/union_vnops.c 16 Feb 2014 09:50:25 -0000 1.56 +++ sys/fs/union/union_vnops.c 25 Feb 2014 11:53:23 -0000 @@ -1597,12 +1597,34 @@ union_lock(void *v) struct vnode *a_vp; int a_flags; } */ *ap = v; struct vnode *vp; - struct union_node *un; + struct union_node *un = VTOUNION(ap->a_vp); + int flags = ap->a_flags; int error; - un = VTOUNION(ap->a_vp); + if ((flags & LK_NOWAIT) != 0) { + if (!mutex_tryenter(&un->un_lock)) + return EBUSY; + vp = LOCKVP(ap->a_vp); + if (!mutex_tryenter(vp->v_interlock)) { + mutex_exit(&un->un_lock); + return EBUSY; + } + if ((vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) { + mutex_exit(vp->v_interlock); + mutex_exit(&un->un_lock); + return EBUSY; + } + mutex_exit(vp->v_interlock); + if (vp == ap->a_vp) + error = genfs_lock(ap); + else + error = VOP_LOCK(vp, flags); + mutex_exit(&un->un_lock); + return error; + } + mutex_enter(&un->un_lock); for (;;) { vp = LOCKVP(ap->a_vp); mutex_exit(&un->un_lock); @@ -1619,11 +1641,24 @@ union_lock(void *v) genfs_unlock(ap); else VOP_UNLOCK(vp); } + mutex_enter(vp->v_interlock); + if ((vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) { + if (vp == ap->a_vp) + genfs_unlock(ap); + else + VOP_UNLOCK(vp); + if ((vp->v_iflag & VI_XLOCK)) + vwait(vp, VI_XLOCK); + mutex_exit(vp->v_interlock); + mutex_exit(&un->un_lock); + return ENOENT; + } + mutex_exit(vp->v_interlock); mutex_exit(&un->un_lock); - return error; + return 0; } int union_unlock(void *v) Index: sys/miscfs/deadfs/dead_vnops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/deadfs/dead_vnops.c,v retrieving revision 1.54 diff -p -u -4 -r1.54 dead_vnops.c --- sys/miscfs/deadfs/dead_vnops.c 7 Feb 2014 15:29:22 -0000 1.54 +++ sys/miscfs/deadfs/dead_vnops.c 25 Feb 2014 11:53:26 -0000 @@ -64,14 +64,14 @@ int dead_rmdir(void *); #define dead_fsync genfs_nullop #define dead_seek genfs_nullop int dead_inactive(void *); #define dead_reclaim genfs_nullop -#define dead_lock genfs_lock -#define dead_unlock genfs_unlock +#define dead_lock genfs_deadlock +#define dead_unlock genfs_deadunlock int dead_bmap(void *); int dead_strategy(void *); int dead_print(void *); -#define dead_islocked genfs_islocked +#define dead_islocked genfs_deadislocked #define dead_revoke genfs_nullop int dead_getpages(void *); int dead_putpages(void *); Index: sys/miscfs/fdesc/fdesc_vnops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/fdesc/fdesc_vnops.c,v retrieving revision 1.117 diff -p -u -4 -r1.117 fdesc_vnops.c --- sys/miscfs/fdesc/fdesc_vnops.c 7 Feb 2014 15:29:22 -0000 1.117 +++ sys/miscfs/fdesc/fdesc_vnops.c 25 Feb 2014 11:53:30 -0000 @@ -248,9 +248,10 @@ loop: fd->fd_fd = -1; fd->fd_link = 0; fd->fd_ix = ix; uvm_vnp_setsize(*vpp, 0); - VOP_LOCK(*vpp, LK_EXCLUSIVE); + error = VOP_LOCK(*vpp, LK_EXCLUSIVE); + KASSERT(error == 0); LIST_INSERT_HEAD(fc, fd, fd_hash); mutex_exit(&fdcache_lock); return 0; Index: sys/miscfs/kernfs/kernfs_subr.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/kernfs/kernfs_subr.c,v retrieving revision 1.25 diff -p -u -4 -r1.25 kernfs_subr.c --- sys/miscfs/kernfs/kernfs_subr.c 22 Mar 2012 20:34:38 -0000 1.25 +++ sys/miscfs/kernfs/kernfs_subr.c 25 Feb 2014 11:53:33 -0000 @@ -321,11 +321,13 @@ kernfs_hashget(kfstype type, struct moun void kernfs_hashins(struct kernfs_node *pp) { struct kfs_hashhead *ppp; + int error __diagused; /* lock the kfsnode, then put it on the appropriate hash list */ - VOP_LOCK(KERNFSTOV(pp), LK_EXCLUSIVE); + error = VOP_LOCK(KERNFSTOV(pp), LK_EXCLUSIVE); + KASSERT(error == 0); mutex_enter(&kfs_ihash_lock); ppp = &kfs_hashtbl[KFSVALUEHASH(pp->kfs_value)]; LIST_INSERT_HEAD(ppp, pp, kfs_hash); Index: sys/miscfs/nullfs/null_vnops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/nullfs/null_vnops.c,v retrieving revision 1.38 diff -p -u -4 -r1.38 null_vnops.c --- sys/miscfs/nullfs/null_vnops.c 11 Jul 2011 08:27:38 -0000 1.38 +++ sys/miscfs/nullfs/null_vnops.c 25 Feb 2014 11:53:36 -0000 @@ -105,8 +105,9 @@ const struct vnodeopv_entry_desc null_vn { &vop_access_desc, layer_access }, { &vop_fsync_desc, layer_fsync }, { &vop_inactive_desc, layer_inactive }, { &vop_reclaim_desc, layer_reclaim }, + { &vop_lock_desc, layer_lock }, { &vop_print_desc, layer_print }, { &vop_remove_desc, layer_remove }, { &vop_rename_desc, layer_rename }, { &vop_revoke_desc, layer_revoke }, Index: sys/miscfs/overlay/overlay_vnops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/overlay/overlay_vnops.c,v retrieving revision 1.19 diff -p -u -4 -r1.19 overlay_vnops.c --- sys/miscfs/overlay/overlay_vnops.c 11 Jul 2011 08:27:39 -0000 1.19 +++ sys/miscfs/overlay/overlay_vnops.c 25 Feb 2014 11:53:39 -0000 @@ -154,8 +154,9 @@ const struct vnodeopv_entry_desc overlay { &vop_access_desc, layer_access }, { &vop_fsync_desc, layer_fsync }, { &vop_inactive_desc, layer_inactive }, { &vop_reclaim_desc, layer_reclaim }, + { &vop_lock_desc, layer_lock }, { &vop_print_desc, layer_print }, { &vop_remove_desc, layer_remove }, { &vop_rename_desc, layer_rename }, { &vop_revoke_desc, layer_revoke }, Index: sys/miscfs/umapfs/umap_vnops.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/umapfs/umap_vnops.c,v retrieving revision 1.55 diff -p -u -4 -r1.55 umap_vnops.c --- sys/miscfs/umapfs/umap_vnops.c 9 Feb 2014 17:18:38 -0000 1.55 +++ sys/miscfs/umapfs/umap_vnops.c 25 Feb 2014 11:53:43 -0000 @@ -88,8 +88,9 @@ const struct vnodeopv_entry_desc umap_vn { &vop_fsync_desc, layer_fsync }, { &vop_inactive_desc, layer_inactive }, { &vop_reclaim_desc, layer_reclaim }, + { &vop_lock_desc, layer_lock }, { &vop_open_desc, layer_open }, { &vop_setattr_desc, layer_setattr }, { &vop_access_desc, layer_access }, { &vop_remove_desc, layer_remove }, Index: sys/coda/coda_vnops.c =================================================================== RCS file: /cvsroot/src/sys/coda/coda_vnops.c,v retrieving revision 1.94 diff -p -u -4 -r1.94 coda_vnops.c --- sys/coda/coda_vnops.c 7 Feb 2014 15:29:21 -0000 1.94 +++ sys/coda/coda_vnops.c 25 Feb 2014 11:53:46 -0000 @@ -228,10 +228,9 @@ coda_open(void *v) vnode_t *container_vp; MARK_ENTRY(CODA_OPEN_STATS); - if (!VOP_ISLOCKED(vp)) - VOP_LOCK(vp, LK_EXCLUSIVE); + KASSERT(VOP_ISLOCKED(vp)); /* Check for open of control file. */ if (IS_CTL_VP(vp)) { /* if (WRITABLE(flag)) */ if (flag & (FWRITE | O_TRUNC | O_CREAT | O_EXCL)) { @@ -1744,10 +1743,8 @@ coda_grab_vnode(vnode_t *uvp, dev_t dev, } /* * Obtain vnode from mount point and inode. - * XXX VFS_VGET does not clearly define locked/referenced state of - * returned vnode. */ error = VFS_VGET(mp, ino, vpp); if (error) { myprintf(("%s: iget/vget(0x%llx, %llu) returns %p, err %d\n", __func__, @@ -1756,10 +1753,9 @@ coda_grab_vnode(vnode_t *uvp, dev_t dev, } /* share the underlying vnode lock with the coda vnode */ mutex_obj_hold((*vpp)->v_interlock); uvm_obj_setlock(&uvp->v_uobj, (*vpp)->v_interlock); - if (!VOP_ISLOCKED(*vpp)) - VOP_LOCK(*vpp, LK_EXCLUSIVE); + KASSERT(VOP_ISLOCKED(*vpp)); return(0); } static void Index: sys/fs/adosfs/adutil.c =================================================================== RCS file: /cvsroot/src/sys/fs/adosfs/adutil.c,v retrieving revision 1.15 diff -p -u -4 -r1.15 adutil.c --- sys/fs/adosfs/adutil.c 12 Jun 2011 03:35:52 -0000 1.15 +++ sys/fs/adosfs/adutil.c 25 Feb 2014 11:53:49 -0000 @@ -84,9 +84,12 @@ start_over: */ void adosfs_ainshash(struct adosfsmount *amp, struct anode *ap) { - VOP_LOCK(ATOV(ap), LK_EXCLUSIVE); + int error __diagused; + + error = VOP_LOCK(ATOV(ap), LK_EXCLUSIVE); + KASSERT(error == 0); mutex_enter(&adosfs_hashlock); LIST_INSERT_HEAD(&->anodetab[AHASH(ap->block)], ap, link); mutex_exit(&adosfs_hashlock); Index: sys/fs/cd9660/cd9660_node.c =================================================================== RCS file: /cvsroot/src/sys/fs/cd9660/cd9660_node.c,v retrieving revision 1.29 diff -p -u -4 -r1.29 cd9660_node.c --- sys/fs/cd9660/cd9660_node.c 12 Jun 2011 03:35:52 -0000 1.29 +++ sys/fs/cd9660/cd9660_node.c 25 Feb 2014 11:53:53 -0000 @@ -169,17 +169,19 @@ loop: void cd9660_ihashins(struct iso_node *ip) { struct ihashhead *ipp; + int error __diagused; KASSERT(mutex_owned(&cd9660_hashlock)); mutex_enter(&cd9660_ihash_lock); ipp = &isohashtbl[INOHASH(ip->i_dev, ip->i_number)]; LIST_INSERT_HEAD(ipp, ip, i_hash); mutex_exit(&cd9660_ihash_lock); - VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + error = VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + KASSERT(error == 0); } /* * Remove the inode from the hash table. Index: sys/fs/efs/efs_ihash.c =================================================================== RCS file: /cvsroot/src/sys/fs/efs/efs_ihash.c,v retrieving revision 1.9 diff -p -u -4 -r1.9 efs_ihash.c --- sys/fs/efs/efs_ihash.c 29 Apr 2012 20:27:31 -0000 1.9 +++ sys/fs/efs/efs_ihash.c 25 Feb 2014 11:53:56 -0000 @@ -161,13 +161,15 @@ efs_ihashget(dev_t dev, ino_t inum, int void efs_ihashins(struct efs_inode *eip) { struct ihashhead *ipp; + int error __diagused; KASSERT(mutex_owned(&efs_hashlock)); /* lock the inode, then put it on the appropriate hash list */ - VOP_LOCK(EFS_ITOV(eip), LK_EXCLUSIVE); + error = VOP_LOCK(EFS_ITOV(eip), LK_EXCLUSIVE); + KASSERT(error == 0); mutex_enter(&efs_ihash_lock); ipp = &ihashtbl[INOHASH(eip->ei_dev, eip->ei_number)]; LIST_INSERT_HEAD(ipp, eip, ei_hash); Index: sys/fs/filecorefs/filecore_node.c =================================================================== RCS file: /cvsroot/src/sys/fs/filecorefs/filecore_node.c,v retrieving revision 1.25 diff -p -u -4 -r1.25 filecore_node.c --- sys/fs/filecorefs/filecore_node.c 12 Jun 2011 03:35:52 -0000 1.25 +++ sys/fs/filecorefs/filecore_node.c 25 Feb 2014 11:53:59 -0000 @@ -187,15 +187,17 @@ loop: void filecore_ihashins(struct filecore_node *ip) { struct ihashhead *ipp; + int error __diagused; mutex_enter(&filecore_ihash_lock); ipp = &filecorehashtbl[INOHASH(ip->i_dev, ip->i_number)]; LIST_INSERT_HEAD(ipp, ip, i_hash); mutex_exit(&filecore_ihash_lock); - VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + error = VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + KASSERT(error == 0); } /* * Remove the inode from the hash table. Index: sys/fs/hfs/hfs_nhash.c =================================================================== RCS file: /cvsroot/src/sys/fs/hfs/hfs_nhash.c,v retrieving revision 1.12 diff -p -u -4 -r1.12 hfs_nhash.c --- sys/fs/hfs/hfs_nhash.c 12 Jun 2011 03:35:53 -0000 1.12 +++ sys/fs/hfs/hfs_nhash.c 25 Feb 2014 11:54:02 -0000 @@ -147,11 +147,13 @@ loop: void hfs_nhashinsert(struct hfsnode *hp) { struct nhashhead *hpp; + int error __diagused; /* lock the inode, then put it on the appropriate hash list */ - VOP_LOCK(HTOV(hp), LK_EXCLUSIVE); + error = VOP_LOCK(HTOV(hp), LK_EXCLUSIVE); + KASSERT(error == 0); mutex_enter(&hfs_nhash_lock); hpp = &nhashtbl[HNOHASH(hp->h_dev, hp->h_rec.u.cnid, hp->h_fork)]; LIST_INSERT_HEAD(hpp, hp, h_hash); Index: sys/fs/ptyfs/ptyfs_subr.c =================================================================== RCS file: /cvsroot/src/sys/fs/ptyfs/ptyfs_subr.c,v retrieving revision 1.25 diff -p -u -4 -r1.25 ptyfs_subr.c --- sys/fs/ptyfs/ptyfs_subr.c 24 Oct 2012 23:36:15 -0000 1.25 +++ sys/fs/ptyfs/ptyfs_subr.c 25 Feb 2014 11:54:05 -0000 @@ -396,11 +396,13 @@ loop: static void ptyfs_hashins(struct ptyfsnode *pp) { struct ptyfs_hashhead *ppp; + int error __diagused; /* lock the ptyfsnode, then put it on the appropriate hash list */ - VOP_LOCK(PTYFSTOV(pp), LK_EXCLUSIVE); + error = VOP_LOCK(PTYFSTOV(pp), LK_EXCLUSIVE); + KASSERT(error == 0); mutex_enter(&ptyfs_used_slock); ppp = &ptyfs_used_tbl[PTYHASH(pp->ptyfs_type, pp->ptyfs_pty, ptyfs_used_mask)]; Index: sys/fs/tmpfs/tmpfs_vnops.c =================================================================== RCS file: /cvsroot/src/sys/fs/tmpfs/tmpfs_vnops.c,v retrieving revision 1.115 diff -p -u -4 -r1.115 tmpfs_vnops.c --- sys/fs/tmpfs/tmpfs_vnops.c 7 Feb 2014 15:29:22 -0000 1.115 +++ sys/fs/tmpfs/tmpfs_vnops.c 25 Feb 2014 11:54:09 -0000 @@ -1081,18 +1081,16 @@ tmpfs_reclaim(void *v) tmpfs_node_t *node = VP_TO_TMPFS_NODE(vp); bool recycle; mutex_enter(&node->tn_vlock); - VOP_LOCK(vp, LK_EXCLUSIVE); /* Disassociate inode from vnode. */ node->tn_vnode = NULL; vp->v_data = NULL; /* If inode is not referenced, i.e. no links, then destroy it. */ recycle = node->tn_links == 0 && TMPFS_NODE_RECLAIMING(node) == 0; - VOP_UNLOCK(vp); mutex_exit(&node->tn_vlock); if (recycle) { tmpfs_free_node(tmp, node); Index: sys/nfs/nfs_node.c =================================================================== RCS file: /cvsroot/src/sys/nfs/nfs_node.c,v retrieving revision 1.116 diff -p -u -4 -r1.116 nfs_node.c --- sys/nfs/nfs_node.c 12 Jun 2011 03:35:59 -0000 1.116 +++ sys/nfs/nfs_node.c 25 Feb 2014 11:54:12 -0000 @@ -228,9 +228,10 @@ loop: np->n_rcred = curlwp->l_cred; kauth_cred_hold(np->n_rcred); np->n_wcred = curlwp->l_cred; kauth_cred_hold(np->n_wcred); - VOP_LOCK(vp, LK_EXCLUSIVE); + error = VOP_LOCK(vp, LK_EXCLUSIVE); + KASSERT(error == 0); NFS_INVALIDATE_ATTRCACHE(np); uvm_vnp_setsize(vp, 0); (void)rb_tree_insert_node(&nmp->nm_rbtree, np); rw_exit(&nmp->nm_rbtlock); Index: sys/ufs/chfs/chfs_ihash.c =================================================================== RCS file: /cvsroot/src/sys/ufs/chfs/chfs_ihash.c,v retrieving revision 1.2 diff -p -u -4 -r1.2 chfs_ihash.c --- sys/ufs/chfs/chfs_ihash.c 19 Oct 2012 12:44:39 -0000 1.2 +++ sys/ufs/chfs/chfs_ihash.c 25 Feb 2014 11:54:15 -0000 @@ -182,15 +182,17 @@ loop: void chfs_ihashins(struct chfs_inode *ip) { struct ihashhead *ipp; + int error __diagused; dbg("ip: %p\n", ip); KASSERT(mutex_owned(&chfs_hashlock)); /* lock the inode, then put it on the appropriate hash list */ - VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + error = VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + KASSERT(error == 0); mutex_enter(&chfs_ihash_lock); ipp = &chfs_ihashtbl[INOHASH(ip->dev, ip->ino)]; LIST_INSERT_HEAD(ipp, ip, hash_entry); Index: sys/ufs/lfs/ulfs_ihash.c =================================================================== RCS file: /cvsroot/src/sys/ufs/lfs/ulfs_ihash.c,v retrieving revision 1.3 diff -p -u -4 -r1.3 ulfs_ihash.c --- sys/ufs/lfs/ulfs_ihash.c 6 Jun 2013 00:48:04 -0000 1.3 +++ sys/ufs/lfs/ulfs_ihash.c 25 Feb 2014 11:54:18 -0000 @@ -167,13 +167,15 @@ ulfs_ihashget(dev_t dev, ino_t inum, int void ulfs_ihashins(struct inode *ip) { struct ihashhead *ipp; + int error __diagused; KASSERT(mutex_owned(&ulfs_hashlock)); /* lock the inode, then put it on the appropriate hash list */ - VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + error = VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + KASSERT(error == 0); mutex_enter(&ulfs_ihash_lock); ipp = &ihashtbl[INOHASH(ip->i_dev, ip->i_number)]; LIST_INSERT_HEAD(ipp, ip, i_hash); Index: sys/ufs/ufs/ufs_ihash.c =================================================================== RCS file: /cvsroot/src/sys/ufs/ufs/ufs_ihash.c,v retrieving revision 1.31 diff -p -u -4 -r1.31 ufs_ihash.c --- sys/ufs/ufs/ufs_ihash.c 12 Jun 2011 03:36:02 -0000 1.31 +++ sys/ufs/ufs/ufs_ihash.c 25 Feb 2014 11:54:21 -0000 @@ -166,13 +166,15 @@ ufs_ihashget(dev_t dev, ino_t inum, int void ufs_ihashins(struct inode *ip) { struct ihashhead *ipp; + int error __diagused; KASSERT(mutex_owned(&ufs_hashlock)); /* lock the inode, then put it on the appropriate hash list */ - VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + error = VOP_LOCK(ITOV(ip), LK_EXCLUSIVE); + KASSERT(error == 0); mutex_enter(&ufs_ihash_lock); ipp = &ihashtbl[INOHASH(ip->i_dev, ip->i_number)]; LIST_INSERT_HEAD(ipp, ip, i_hash);