summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2019-05-03 14:24:13 +0000
committervisa <visa@openbsd.org>2019-05-03 14:24:13 +0000
commitd0403264978369caf819f77b5d80ad287c346c38 (patch)
tree9a15640438d1f98d44b77f5113ce44a26597a321
parentOnly fetch and upgrade if a new snapshot is available. (diff)
downloadwireguard-openbsd-d0403264978369caf819f77b5d80ad287c346c38.tar.xz
wireguard-openbsd-d0403264978369caf819f77b5d80ad287c346c38.zip
Make VOP_ADVLOCK() safe to use without kernel lock
All non-dummy implementations of VOP_ADVLOCK() rely on lf_advlock() which is now safe to use without the kernel lock. Because VOP_ADVLOCK() does not make the vnode dirty, it is unnecessary to keep track of in-flight vnode lock operations and the updating of vnode->v_inflight can be dropped from VOP_ADVLOCK(). This makes VOP_ADVLOCK() safe to use without the kernel lock. OK tedu@ mpi@
-rw-r--r--sys/kern/vfs_vops.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/kern/vfs_vops.c b/sys/kern/vfs_vops.c
index 7b9cf43dfc4..9c39ab07705 100644
--- a/sys/kern/vfs_vops.c
+++ b/sys/kern/vfs_vops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_vops.c,v 1.20 2019/02/17 22:17:28 tedu Exp $ */
+/* $OpenBSD: vfs_vops.c,v 1.21 2019/05/03 14:24:13 visa Exp $ */
/*
* Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org>
*
@@ -687,7 +687,6 @@ VOP_PATHCONF(struct vnode *vp, int name, register_t *retval)
int
VOP_ADVLOCK(struct vnode *vp, void *id, int op, struct flock *fl, int flags)
{
- int r;
struct vop_advlock_args a;
a.a_vp = vp;
a.a_id = id;
@@ -698,10 +697,7 @@ VOP_ADVLOCK(struct vnode *vp, void *id, int op, struct flock *fl, int flags)
if (vp->v_op->vop_advlock == NULL)
return (EOPNOTSUPP);
- vp->v_inflight++;
- r = (vp->v_op->vop_advlock)(&a);
- vp->v_inflight--;
- return r;
+ return (vp->v_op->vop_advlock)(&a);
}
int