diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_subr.c | 7 | ||||
-rw-r--r-- | sys/kern/vfs_vops.c | 16 | ||||
-rw-r--r-- | sys/nfs/nfs_node.c | 5 | ||||
-rw-r--r-- | sys/sys/vnode.h | 5 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_subr.c | 5 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_subr.c | 5 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 5 | ||||
-rw-r--r-- | sys/uvm/uvm_vnode.c | 4 |
8 files changed, 32 insertions, 20 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index f807760ea9d..794a4f2cf03 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.307 2021/10/19 06:26:08 semarie Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.308 2021/10/20 06:35:39 semarie Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -1075,6 +1075,9 @@ 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) { @@ -1927,7 +1930,7 @@ vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, struct proc *p, int s, error; #ifdef VFSLCKDEBUG - if ((vp->v_op->vop_islocked != nullop) && !VOP_ISLOCKED(vp)) + if ((vp->v_flag & VLOCKSWORK) && !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 c951368c158..c4562ecfaf5 100644 --- a/sys/kern/vfs_vops.c +++ b/sys/kern/vfs_vops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vops.c,v 1.32 2021/10/19 06:26:09 semarie Exp $ */ +/* $OpenBSD: vfs_vops.c,v 1.33 2021/10/20 06:35:39 semarie Exp $ */ /* * Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org> * @@ -48,15 +48,11 @@ #include <sys/systm.h> #ifdef VFSLCKDEBUG -#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);\ - } \ +#define ASSERT_VP_ISLOCKED(vp) do { \ + if (((vp)->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) { \ + VOP_PRINT(vp); \ + panic("vp not locked"); \ + } \ } while (0) #else #define ASSERT_VP_ISLOCKED(vp) /* nothing */ diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c index 1069ad597da..958d64378ec 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_node.c,v 1.73 2021/10/19 06:26:09 semarie Exp $ */ +/* $OpenBSD: nfs_node.c,v 1.74 2021/10/20 06:35:39 semarie Exp $ */ /* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */ /* @@ -133,6 +133,9 @@ loop: } vp = nvp; +#ifdef VFSLCKDEBUG + vp->v_flag |= VLOCKSWORK; +#endif rrw_init_flags(&np->n_lock, "nfsnode", RWL_DUPOK | RWL_IS_VNODE); vp->v_data = np; /* we now have an nfsnode on this vnode */ diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index b46719db71c..f318b77cc7c 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.161 2021/10/19 06:26:09 semarie Exp $ */ +/* $OpenBSD: vnode.h,v 1.162 2021/10/20 06:35:39 semarie Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /* @@ -146,7 +146,8 @@ struct vnode { #define VCLONED 0x0400 /* vnode was cloned */ #define VALIASED 0x0800 /* vnode has an alias */ #define VLARVAL 0x1000 /* vnode data not yet set up by higher level */ -#define VCLONE 0x4000 /* vnode is a clone */ +#define VLOCKSWORK 0x4000 /* FS supports locking discipline */ +#define VCLONE 0x8000 /* vnode is a clone */ /* * (v_bioflag) Flags that may be manipulated by interrupt handlers diff --git a/sys/ufs/ext2fs/ext2fs_subr.c b/sys/ufs/ext2fs/ext2fs_subr.c index b0fb0323818..b03939be476 100644 --- a/sys/ufs/ext2fs/ext2fs_subr.c +++ b/sys/ufs/ext2fs/ext2fs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_subr.c,v 1.36 2021/10/19 06:26:09 semarie Exp $ */ +/* $OpenBSD: ext2fs_subr.c,v 1.37 2021/10/20 06:35:39 semarie Exp $ */ /* $NetBSD: ext2fs_subr.c,v 1.1 1997/06/11 09:34:03 bouyer Exp $ */ /* @@ -170,6 +170,9 @@ ext2fs_vinit(struct mount *mp, struct vnode **vpp) nvp->v_data = vp->v_data; vp->v_data = NULL; vp->v_op = &spec_vops; +#ifdef VFSLCKDEBUG + vp->v_flag &= ~VLOCKSWORK; +#endif vrele(vp); vgone(vp); /* Reinitialize aliased vnode. */ diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index 7cc6a54a8d9..64d353860a3 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_subr.c,v 1.33 2021/10/19 06:26:09 semarie Exp $ */ +/* $OpenBSD: ffs_subr.c,v 1.34 2021/10/20 06:35:39 semarie Exp $ */ /* $NetBSD: ffs_subr.c,v 1.6 1996/03/17 02:16:23 christos Exp $ */ /* @@ -272,6 +272,9 @@ ffs_vinit(struct mount *mntp, struct vnode **vpp) nvp->v_data = vp->v_data; vp->v_data = NULL; vp->v_op = &spec_vops; +#ifdef VFSLCKDEBUG + vp->v_flag &= ~VLOCKSWORK; +#endif vrele(vp); vgone(vp); /* diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 0b40150c13a..b513a271877 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.191 2021/10/19 06:26:09 semarie Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.192 2021/10/20 06:35:39 semarie Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -1324,6 +1324,9 @@ retry: return (error); } +#ifdef VFSLCKDEBUG + vp->v_flag |= VLOCKSWORK; +#endif ip = pool_get(&ffs_ino_pool, PR_WAITOK|PR_ZERO); rrw_init_flags(&ip->i_lock, "inode", RWL_DUPOK | RWL_IS_VNODE); ip->i_ump = ump; diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c index b97edd59dad..7d5984403bf 100644 --- a/sys/uvm/uvm_vnode.c +++ b/sys/uvm/uvm_vnode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_vnode.c,v 1.117 2021/10/19 06:26:09 semarie Exp $ */ +/* $OpenBSD: uvm_vnode.c,v 1.118 2021/10/20 06:35:40 semarie Exp $ */ /* $NetBSD: uvm_vnode.c,v 1.36 2000/11/24 20:34:01 chs Exp $ */ /* @@ -1328,7 +1328,7 @@ uvm_vnp_uncache(struct vnode *vp) * carry over sanity check from old vnode pager: the vnode should * be VOP_LOCK'd, and we confirm it here. */ - if ((vp->v_op->vop_islocked != nullop) && !VOP_ISLOCKED(vp)) + if ((vp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) panic("uvm_vnp_uncache: vnode not locked!"); #endif |