diff options
| author | thorpej <thorpej@NetBSD.org> | 2004-09-21 03:10:35 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2004-09-21 03:10:35 +0000 |
| commit | 11afd11faa6eb689d578a500238c7b379b839e3e (patch) | |
| tree | 209256d1d7a4da5dcb82e4aaac8f2e9229a87b80 /sys/kern/vnode_if.src | |
| parent | 14a961d3189199d0f85f79cbbc965f7e49f46df9 (diff) | |
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.
Diffstat (limited to 'sys/kern/vnode_if.src')
| -rw-r--r-- | sys/kern/vnode_if.src | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index e10748da0eb..154069e39f8 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -1,4 +1,4 @@ -# $NetBSD: vnode_if.src,v 1.40 2004/09/10 09:37:41 yamt Exp $ +# $NetBSD: vnode_if.src,v 1.41 2004/09/21 03:10:35 thorpej Exp $ # # Copyright (c) 1992, 1993 # The Regents of the University of California. All rights reserved. @@ -105,7 +105,7 @@ vop_lookup { #! create cnp CREATE, LOCKPARENT # vop_create { - IN WILLPUT struct vnode *dvp; + IN LOCKED=YES WILLPUT struct vnode *dvp; OUT struct vnode **vpp; IN struct componentname *cnp; IN struct vattr *vap; @@ -118,7 +118,7 @@ vop_create { #! mknod cnp CREATE, LOCKPARENT # vop_mknod { - IN WILLPUT struct vnode *dvp; + IN LOCKED=YES WILLPUT struct vnode *dvp; OUT struct vnode **vpp; IN struct componentname *cnp; IN struct vattr *vap; @@ -128,7 +128,7 @@ vop_mknod { #% open vp L L L # vop_open { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN int mode; IN struct ucred *cred; IN struct proc *p; @@ -138,7 +138,7 @@ vop_open { #% close vp L L L # vop_close { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN int fflag; IN struct ucred *cred; IN struct proc *p; @@ -148,7 +148,7 @@ vop_close { #% access vp L L L # vop_access { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN int mode; IN struct ucred *cred; IN struct proc *p; @@ -168,7 +168,7 @@ vop_getattr { #% setattr vp L L L # vop_setattr { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN struct vattr *vap; IN struct ucred *cred; IN struct proc *p; @@ -178,7 +178,7 @@ vop_setattr { #% read vp L L L # vop_read { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; INOUT struct uio *uio; IN int ioflag; IN struct ucred *cred; @@ -188,7 +188,7 @@ vop_read { #% write vp L L L # vop_write { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; INOUT struct uio *uio; IN int ioflag; IN struct ucred *cred; @@ -198,7 +198,7 @@ vop_write { #% ioctl vp U U U # vop_ioctl { - IN struct vnode *vp; + IN LOCKED=NO struct vnode *vp; IN u_long command; IN void *data; IN int fflag; @@ -210,7 +210,7 @@ vop_ioctl { #% fcntl vp L L L # vop_fcntl { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN u_int command; IN void *data; IN int fflag; @@ -222,7 +222,7 @@ vop_fcntl { #% poll vp U U U # vop_poll { - IN struct vnode *vp; + IN LOCKED=NO struct vnode *vp; IN int events; IN struct proc *p; }; @@ -231,7 +231,7 @@ vop_poll { #% kqfilter vp U U U # vop_kqfilter { - IN struct vnode *vp; + IN LOCKED=NO struct vnode *vp; IN struct knote *kn; }; @@ -239,7 +239,7 @@ vop_kqfilter { #% revoke vp U U U # vop_revoke { - IN struct vnode *vp; + IN LOCKED=NO struct vnode *vp; IN int flags; }; @@ -257,7 +257,7 @@ vop_mmap { #% fsync vp L L L # vop_fsync { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN struct ucred *cred; IN int flags; IN off_t offlo; @@ -267,6 +267,7 @@ vop_fsync { # # Needs work: Is newoff right? What's it mean? +# XXX Locking prototocl? # vop_seek { IN struct vnode *vp; @@ -282,20 +283,20 @@ vop_seek { #! remove cnp DELETE, LOCKPARENT | LOCKLEAF # vop_remove { - IN WILLPUT struct vnode *dvp; - IN WILLPUT struct vnode *vp; + IN LOCKED=YES WILLPUT struct vnode *dvp; + IN LOCKED=YES WILLPUT struct vnode *vp; IN struct componentname *cnp; }; # #% link vp U U U -#% link tdvp L U U +#% link dvp L U U # #! link cnp CREATE, LOCKPARENT # vop_link { - IN WILLPUT struct vnode *dvp; - IN struct vnode *vp; + IN LOCKED=YES WILLPUT struct vnode *dvp; + IN LOCKED=NO struct vnode *vp; IN struct componentname *cnp; }; @@ -311,10 +312,10 @@ vop_link { # XXX the vop_rename routines should REALLY NOT be depending on SAVESTART! # vop_rename { - IN WILLRELE struct vnode *fdvp; - IN WILLRELE struct vnode *fvp; + IN LOCKED=NO WILLRELE struct vnode *fdvp; + IN LOCKED=NO WILLRELE struct vnode *fvp; IN struct componentname *fcnp; - IN WILLPUT struct vnode *tdvp; + IN LOCKED=YES WILLPUT struct vnode *tdvp; IN WILLPUT struct vnode *tvp; IN struct componentname *tcnp; }; @@ -326,7 +327,7 @@ vop_rename { #! mkdir cnp CREATE, LOCKPARENT # vop_mkdir { - IN WILLPUT struct vnode *dvp; + IN LOCKED=YES WILLPUT struct vnode *dvp; OUT struct vnode **vpp; IN struct componentname *cnp; IN struct vattr *vap; @@ -339,8 +340,8 @@ vop_mkdir { #! rmdir cnp DELETE, LOCKPARENT | LOCKLEAF # vop_rmdir { - IN WILLPUT struct vnode *dvp; - IN WILLPUT struct vnode *vp; + IN LOCKED=YES WILLPUT struct vnode *dvp; + IN LOCKED=YES WILLPUT struct vnode *vp; IN struct componentname *cnp; }; @@ -351,7 +352,7 @@ vop_rmdir { #! symlink cnp CREATE, LOCKPARENT # vop_symlink { - IN WILLPUT struct vnode *dvp; + IN LOCKED=YES WILLPUT struct vnode *dvp; OUT struct vnode **vpp; IN struct componentname *cnp; IN struct vattr *vap; @@ -362,7 +363,7 @@ vop_symlink { #% readdir vp L L L # vop_readdir { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; INOUT struct uio *uio; IN struct ucred *cred; OUT int *eofflag; @@ -374,7 +375,7 @@ vop_readdir { #% readlink vp L L L # vop_readlink { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; INOUT struct uio *uio; IN struct ucred *cred; }; @@ -393,7 +394,7 @@ vop_abortop { #% inactive vp L U U # vop_inactive { - IN WILLUNLOCK struct vnode *vp; + IN LOCKED=YES WILLUNLOCK struct vnode *vp; IN struct proc *p; }; @@ -401,7 +402,7 @@ vop_inactive { #% reclaim vp U U U # vop_reclaim { - IN struct vnode *vp; + IN LOCKED=NO struct vnode *vp; IN struct proc *p; }; @@ -409,7 +410,7 @@ vop_reclaim { #% lock vp U L U # vop_lock { - IN struct vnode *vp; + IN LOCKED=NO struct vnode *vp; IN int flags; }; @@ -417,7 +418,7 @@ vop_lock { #% unlock vp L U L # vop_unlock { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN int flags; }; @@ -426,7 +427,7 @@ vop_unlock { #% bmap vpp - U - # vop_bmap { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN daddr_t bn; OUT struct vnode **vpp; IN daddr_t *bnp; @@ -459,7 +460,7 @@ vop_islocked { #% pathconf vp L L L # vop_pathconf { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN int name; OUT register_t *retval; }; @@ -468,7 +469,7 @@ vop_pathconf { #% advlock vp U U U # vop_advlock { - IN struct vnode *vp; + IN LOCKED=NO struct vnode *vp; IN void *id; IN int op; IN struct flock *fl; @@ -479,7 +480,7 @@ vop_advlock { #% blkatoff vp L L L # vop_blkatoff { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN off_t offset; OUT char **res; OUT struct buf **bpp; @@ -489,7 +490,7 @@ vop_blkatoff { #% valloc pvp L L L # vop_valloc { - IN struct vnode *pvp; + IN LOCKED=YES struct vnode *pvp; IN int mode; IN struct ucred *cred; OUT struct vnode **vpp; @@ -499,7 +500,7 @@ vop_valloc { #% balloc vp L L L # vop_balloc { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN off_t startoffset; IN int size; IN struct ucred *cred; @@ -511,7 +512,7 @@ vop_balloc { #% reallocblks vp L L L # vop_reallocblks { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN struct cluster_save *buflist; }; @@ -519,7 +520,7 @@ vop_reallocblks { #% vfree pvp L L L # vop_vfree { - IN struct vnode *pvp; + IN LOCKED=YES struct vnode *pvp; IN ino_t ino; IN int mode; }; @@ -528,7 +529,7 @@ vop_vfree { #% truncate vp L L L # vop_truncate { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN off_t length; IN int flags; IN struct ucred *cred; @@ -539,7 +540,7 @@ vop_truncate { #% update vp L L L # vop_update { - IN struct vnode *vp; + IN LOCKED=YES struct vnode *vp; IN struct timespec *access; IN struct timespec *modify; IN int flags; @@ -563,7 +564,7 @@ vop_lease { #! whiteout cnp CREATE, LOCKPARENT # vop_whiteout { - IN struct vnode *dvp; + IN LOCKED=YES struct vnode *dvp; IN struct componentname *cnp; IN int flags; }; |
