diff options
author | jeff <jeff@FreeBSD.org> | 2002-08-22 07:44:45 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-08-22 07:44:45 +0000 |
commit | 6c5497f47a5a81903384421e5b55e10c76905d75 (patch) | |
tree | 411a5434a85b431b5c0bd93d908225f8527b52d7 /sys/kern/vfs_subr.c | |
parent | 120149c075e60c80ddba7f60e2a0d4b9eb1e3ce4 (diff) | |
download | FreeBSD-src-6c5497f47a5a81903384421e5b55e10c76905d75.zip FreeBSD-src-6c5497f47a5a81903384421e5b55e10c76905d75.tar.gz |
- Make vn_lock() vget() and VOP_LOCK() all behave the same way WRT
LK_INTERLOCK. The interlock will never be held on return from these
functions even when there is an error. Errors typically only occur when
the XLOCK is held which means this isn't the vnode we want anyway. Almost
all users of these interfaces expected this behavior even though it was
not provided before.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 96f902a..2193635 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -739,10 +739,9 @@ vcanrecycle(struct vnode *vp) /* We should be able to immediately acquire this */ /* XXX This looks like it should panic if it fails */ - if (vn_lock(vp, LK_INTERLOCK | LK_EXCLUSIVE, td) != 0) { - VI_UNLOCK(vp); + if (vn_lock(vp, LK_INTERLOCK | LK_EXCLUSIVE, td) != 0) return (EWOULDBLOCK); - } + /* * Don't recycle if we still have cached pages. */ @@ -1917,18 +1916,11 @@ vget(vp, flags, td) */ if ((flags & LK_INTERLOCK) == 0) VI_LOCK(vp); - if (vp->v_iflag & VI_XLOCK) { - if (vp->v_vxproc == curthread) { -#if 0 - /* this can now occur in normal operation */ - log(LOG_INFO, "VXLOCK interlock avoided\n"); -#endif - } else { - vp->v_iflag |= VI_XWANT; - msleep(vp, VI_MTX(vp), PINOD | PDROP, "vget", 0); - mp_fixme("interlock not released."); - return (ENOENT); - } + if (vp->v_iflag & VI_XLOCK && vp->v_vxproc != curthread) { + vp->v_iflag |= VI_XWANT; + msleep(vp, VI_MTX(vp), PINOD | PDROP, "vget", 0); + VI_UNLOCK(vp); + return (ENOENT); } vp->v_usecount++; |