diff options
author | Sebastien Marie <semarie@cvs.openbsd.org> | 2021-10-19 06:26:10 +0000 |
---|---|---|
committer | Sebastien Marie <semarie@cvs.openbsd.org> | 2021-10-19 06:26:10 +0000 |
commit | d7e62bb318a2cfa9aae0aec0c2f1a9a910ff1598 (patch) | |
tree | 798f01e933d7433c47eb426b7d6bb00d3bd5f0a5 /sys/kern | |
parent | ad99ca7b42f45873f9f031d43db6672230f5fcf0 (diff) |
vnode: remove VLOCKSWORK and check locking when vop_islocked != nullop
This flag is currently used to mark or unmark a vnode to actively
check vnode locking semantic (when compiled with VFSLCKDEBUG).
Currently, VLOCKSWORK flag isn't properly set for several FS
implementation which have full locking support. This commit enable
proper checking for them too (cd9660, udf, fuse, msdosfs, tmpfs).
Instead of using a particular flag, it directly check if
v_op->vop_islocked is nullop or not to activate or not the vnode
locking checks.
ok mpi@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_subr.c | 7 | ||||
-rw-r--r-- | sys/kern/vfs_vops.c | 16 |
2 files changed, 12 insertions, 11 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index c752dd99e9e..f807760ea9d 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.306 2021/08/31 15:31:28 claudio Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.307 2021/10/19 06:26:08 semarie Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1075,9 +1075,6 @@ vclean(struct vnode *vp, int flags, struct proc *p) vp->v_op = &dead_vops; VN_KNOTE(vp, NOTE_REVOKE); vp->v_tag = VT_NON; -#ifdef VFSLCKDEBUG - vp->v_flag &= ~VLOCKSWORK; -#endif mtx_enter(&vnode_mtx); vp->v_lflag &= ~VXLOCK; if (vp->v_lflag & VXWANT) { @@ -1930,7 +1927,7 @@ vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, struct proc *p, int s, error; #ifdef VFSLCKDEBUG - if ((vp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) + if ((vp->v_op->vop_islocked != nullop) && !VOP_ISLOCKED(vp)) panic("%s: vp isn't locked, vp %p", __func__, vp); #endif diff --git a/sys/kern/vfs_vops.c b/sys/kern/vfs_vops.c index caf2dc327bf..c951368c158 100644 --- a/sys/kern/vfs_vops.c +++ b/sys/kern/vfs_vops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vops.c,v 1.31 2021/10/04 08:11:02 claudio Exp $ */ +/* $OpenBSD: vfs_vops.c,v 1.32 2021/10/19 06:26:09 semarie Exp $ */ /* * Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org> * @@ -48,11 +48,15 @@ #include <sys/systm.h> #ifdef VFSLCKDEBUG -#define ASSERT_VP_ISLOCKED(vp) do { \ - if (((vp)->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) { \ - VOP_PRINT(vp); \ - panic("vp not locked"); \ - } \ +#define ASSERT_VP_ISLOCKED(vp) do { \ + struct vnode *_vp = (vp); \ + int r; \ + if (_vp->v_op->vop_islocked == nullop) \ + break; \ + if ((r = VOP_ISLOCKED(_vp)) != LK_EXCLUSIVE) { \ + VOP_PRINT(_vp); \ + panic("%s: vp not locked, vp %p, %d", __func__, _vp, r);\ + } \ } while (0) #else #define ASSERT_VP_ISLOCKED(vp) /* nothing */ |