svn commit: r216096 - stable/8/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Wed Dec 1 15:28:23 UTC 2010
Author: kib
Date: Wed Dec 1 15:28:23 2010
New Revision: 216096
URL: http://svn.freebsd.org/changeset/base/216096
Log:
MFC r215797:
Allow shared-locked vnode to be passed to vunref(9).
Approved by: re (bz)
Modified:
stable/8/sys/kern/vfs_subr.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/kern/vfs_subr.c
==============================================================================
--- stable/8/sys/kern/vfs_subr.c Wed Dec 1 08:07:32 2010 (r216095)
+++ stable/8/sys/kern/vfs_subr.c Wed Dec 1 15:28:23 2010 (r216096)
@@ -2189,7 +2189,7 @@ vputx(struct vnode *vp, int func)
KASSERT(vp != NULL, ("vputx: null vp"));
if (func == VPUTX_VUNREF)
- ASSERT_VOP_ELOCKED(vp, "vunref");
+ ASSERT_VOP_LOCKED(vp, "vunref");
else if (func == VPUTX_VPUT)
ASSERT_VOP_LOCKED(vp, "vput");
else
@@ -2227,12 +2227,22 @@ vputx(struct vnode *vp, int func)
* as VI_DOINGINACT to avoid recursion.
*/
vp->v_iflag |= VI_OWEINACT;
- if (func == VPUTX_VRELE) {
+ switch (func) {
+ case VPUTX_VRELE:
error = vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK);
VI_LOCK(vp);
- } else if (func == VPUTX_VPUT && VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
- error = VOP_LOCK(vp, LK_UPGRADE | LK_INTERLOCK | LK_NOWAIT);
- VI_LOCK(vp);
+ break;
+ case VPUTX_VPUT:
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
+ error = VOP_LOCK(vp, LK_UPGRADE | LK_INTERLOCK |
+ LK_NOWAIT);
+ VI_LOCK(vp);
+ }
+ break;
+ case VPUTX_VUNREF:
+ if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE)
+ error = EBUSY;
+ break;
}
if (vp->v_usecount > 0)
vp->v_iflag &= ~VI_OWEINACT;
More information about the svn-src-stable
mailing list