Subject: Vnode lock debugging
To: NetBSD tech-kern <tech-kern@netbsd.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 09/20/2004 20:15:19
--Apple-Mail-17--682281280
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 <thorpej@netbsd.org>
> Date: September 20, 2004 8:10:36 PM PDT
> To: source-changes@NetBSD.org
> Subject: CVS commit: src/sys
> Reply-To: thorpej@netbsd.org
>
>
> 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.sh 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 vnode_if.sh 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/vnode_if.sh
> 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 <thorpej@shagadelic.org>


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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFBT5zHOpVKkaBm8XkRAmWdAKCf9ObNyO9nu0fQkUkV5TzQZi2dSwCgk5Ml
a+wlFiDmR/ojAwoJQv1wMdY=
=gj+g
-----END PGP SIGNATURE-----

--Apple-Mail-17--682281280--