Subject: Vnode lock debugging
To: NetBSD tech-kern <>
From: Jason Thorpe <>
List: tech-kern
Date: 09/20/2004 20:15:19
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed

FYI.  I figured "best to get this in the tree and let someone else 
worry about how totally broken the vnode locking protocol is".  :-)

Begin forwarded message:

> From: Jason R Thorpe <>
> Date: September 20, 2004 8:10:36 PM PDT
> To:
> Subject: CVS commit: src/sys
> Reply-To:
> Module Name:	src
> Committed By:	thorpej
> Date:		Tue Sep 21 03:10:36 UTC 2004
> Modified Files:
> 	src/sys/conf: files
> 	src/sys/kern: vfs_subr.c vnode_if.src
> 	src/sys/sys: vnode.h
> 	src/sys/ufs/ext2fs: ext2fs_vfsops.c ext2fs_vnops.c
> 	src/sys/ufs/ffs: ffs_vfsops.c
> 	src/sys/ufs/ufs: ufs_vnops.c
> Log Message:
> Add a new VNODE_LOCKDEBUG option, which enables checks in the VOP_*()
> calls to ensure that the vnode lock state is as expected when the VOP
> call is made.  Modify vnode_if.src to set the expected state according
> to the documenting lock table for each VOP.  Modify to emit
> the checks.
> Notes:
> - The checks are only performed if the vnode has the VLOCKSWORK bit
>   set.  Some file systems (e.g. specfs) don't even bother with vnode
>   locks, so of course the checks will fail.
> - We can't actually run with VNODE_LOCKDEBUG because there are so many
>   vnode locking problems, not the least of which is the "use SHARED for
>   VOP_READ()" issue, which screws things up for the entire call chain.
> Inspired by similar changes in OpenBSD, but implemented differently.
> To generate a diff of this commit:
> cvs rdiff -r1.684 -r1.685 src/sys/conf/files
> cvs rdiff -r1.233 -r1.234 src/sys/kern/vfs_subr.c
> cvs rdiff -r1.34 -r1.35 src/sys/kern/
> cvs rdiff -r1.40 -r1.41 src/sys/kern/vnode_if.src
> cvs rdiff -r1.125 -r1.126 src/sys/sys/vnode.h
> cvs rdiff -r1.75 -r1.76 src/sys/ufs/ext2fs/ext2fs_vfsops.c
> cvs rdiff -r1.56 -r1.57 src/sys/ufs/ext2fs/ext2fs_vnops.c
> cvs rdiff -r1.154 -r1.155 src/sys/ufs/ffs/ffs_vfsops.c
> cvs rdiff -r1.122 -r1.123 src/sys/ufs/ufs/ufs_vnops.c
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
         -- Jason R. Thorpe <>

content-type: application/pgp-signature; x-mac-type=70674453;
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

Version: GnuPG v1.2.3 (Darwin)