summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpedro <pedro@openbsd.org>2005-11-18 13:25:40 +0000
committerpedro <pedro@openbsd.org>2005-11-18 13:25:40 +0000
commita236f0642e167387ee2682fddc62a6d704cf73c9 (patch)
treef3ae2bb8402f8b45ab96d9d17c5561e94718201c
parentBump copyright (watchdog addition). (diff)
downloadwireguard-openbsd-a236f0642e167387ee2682fddc62a6d704cf73c9.tar.xz
wireguard-openbsd-a236f0642e167387ee2682fddc62a6d704cf73c9.zip
Work around yet another race on non-locking file systems: when calling
VOP_INACTIVE() in vrele() and vput(), we may sleep. Since there's no locking of any kind, someone can vget() the vnode and vrele() it while we sleep, beating us in getting the vnode on the free list.
-rw-r--r--sys/kern/vfs_subr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 79fc2b77b34..1525d8cda1b 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.117 2005/11/08 15:50:01 pedro Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.118 2005/11/18 13:25:40 pedro Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -769,7 +769,7 @@ vput(struct vnode *vp)
simple_lock(&vp->v_interlock);
- if (vp->v_usecount == 0)
+ if (vp->v_usecount == 0 && !(vp->v_bioflag & VBIOONFREELIST))
vputonfreelist(vp);
simple_unlock(&vp->v_interlock);
@@ -816,7 +816,7 @@ vrele(struct vnode *vp)
simple_lock(&vp->v_interlock);
- if (vp->v_usecount == 0)
+ if (vp->v_usecount == 0 && !(vp->v_bioflag & VBIOONFREELIST))
vputonfreelist(vp);
simple_unlock(&vp->v_interlock);