Add 'options DEBUG_LOCKS', which stores extra information in struct
lock, and add some macros and function parameters to make sure that the information get to the point where it can be put in the lock structure. While I'm here, add DEBUG_VFS_LOCKS to LINT.
This commit is contained in:
parent
49e314e105
commit
15a1057c46
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=42900
@ -27,7 +27,7 @@
|
||||
* Mellon the rights to redistribute these changes without encumbrance.
|
||||
*
|
||||
* @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
|
||||
* $Id: coda_vnops.c,v 1.11 1999/01/05 18:49:51 eivind Exp $
|
||||
* $Id: coda_vnops.c,v 1.12 1999/01/07 16:14:12 bde Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -48,6 +48,11 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_vnops.c,v $
|
||||
* Revision 1.12 1999/01/07 16:14:12 bde
|
||||
* Don't pass unused unused timestamp args to UFS_UPDATE() or waste
|
||||
* time initializing them. This almost finishes centralizing (in-core)
|
||||
* timestamp updates in ufs_itimes().
|
||||
*
|
||||
* Revision 1.11 1999/01/05 18:49:51 eivind
|
||||
* Remove the 'waslocked' parameter to vfs_object_create().
|
||||
*
|
||||
@ -2037,7 +2042,12 @@ coda_lock(v)
|
||||
cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
|
||||
}
|
||||
|
||||
#ifndef DEBUG_LOCKS
|
||||
return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p));
|
||||
#else
|
||||
return (debuglockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p,
|
||||
"coda_lock", vp->filename, vp->line));
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.537 1999/01/19 15:11:46 des Exp $
|
||||
# $Id: LINT,v 1.538 1999/01/20 03:29:51 msmith Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -1844,6 +1844,14 @@ options "PMAP_SHPGPERPROC=201"
|
||||
#
|
||||
options "NSFBUFS=1024"
|
||||
|
||||
#
|
||||
# Enable extra debugging code for locks. This include storing the
|
||||
# filename and line of whatever aquired the lock in the lock itself,
|
||||
# and changing a number of function calls to pass around the relevant
|
||||
# data. This is not at all useful unless you are debugging lock code.
|
||||
#
|
||||
options DEBUG_LOCKS
|
||||
|
||||
# More undocumented options for linting.
|
||||
|
||||
options CLK_CALIBRATION_LOOP
|
||||
@ -1853,6 +1861,7 @@ options CLUSTERDEBUG
|
||||
options COMPAT_LINUX
|
||||
options CPU_UPGRADE_HW_CACHE
|
||||
options DEBUG
|
||||
options DEBUG_VFS_LOCKS
|
||||
options "DEBUG_1284"
|
||||
#options DISABLE_PSE
|
||||
options "EXT2FS"
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: options,v 1.119 1999/01/15 10:00:10 bde Exp $
|
||||
# $Id: options,v 1.120 1999/01/17 19:02:39 peter Exp $
|
||||
#
|
||||
# On the handling of kernel options
|
||||
#
|
||||
@ -255,6 +255,7 @@ SI_DEBUG opt_debug_si.h
|
||||
|
||||
# These cause changes all over the kernel
|
||||
DEBUG opt_global.h
|
||||
DEBUG_LOCKS opt_global.h
|
||||
DEBUG_VFS_LOCKS opt_global.h
|
||||
DIAGNOSTIC opt_global.h
|
||||
ENABLE_VFS_IOOPT opt_global.h
|
||||
|
@ -27,7 +27,7 @@
|
||||
* Mellon the rights to redistribute these changes without encumbrance.
|
||||
*
|
||||
* @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
|
||||
* $Id: coda_vnops.c,v 1.11 1999/01/05 18:49:51 eivind Exp $
|
||||
* $Id: coda_vnops.c,v 1.12 1999/01/07 16:14:12 bde Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -48,6 +48,11 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log: coda_vnops.c,v $
|
||||
* Revision 1.12 1999/01/07 16:14:12 bde
|
||||
* Don't pass unused unused timestamp args to UFS_UPDATE() or waste
|
||||
* time initializing them. This almost finishes centralizing (in-core)
|
||||
* timestamp updates in ufs_itimes().
|
||||
*
|
||||
* Revision 1.11 1999/01/05 18:49:51 eivind
|
||||
* Remove the 'waslocked' parameter to vfs_object_create().
|
||||
*
|
||||
@ -2037,7 +2042,12 @@ coda_lock(v)
|
||||
cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique));
|
||||
}
|
||||
|
||||
#ifndef DEBUG_LOCKS
|
||||
return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p));
|
||||
#else
|
||||
return (debuglockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p,
|
||||
"coda_lock", vp->filename, vp->line));
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.537 1999/01/19 15:11:46 des Exp $
|
||||
# $Id: LINT,v 1.538 1999/01/20 03:29:51 msmith Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -1844,6 +1844,14 @@ options "PMAP_SHPGPERPROC=201"
|
||||
#
|
||||
options "NSFBUFS=1024"
|
||||
|
||||
#
|
||||
# Enable extra debugging code for locks. This include storing the
|
||||
# filename and line of whatever aquired the lock in the lock itself,
|
||||
# and changing a number of function calls to pass around the relevant
|
||||
# data. This is not at all useful unless you are debugging lock code.
|
||||
#
|
||||
options DEBUG_LOCKS
|
||||
|
||||
# More undocumented options for linting.
|
||||
|
||||
options CLK_CALIBRATION_LOOP
|
||||
@ -1853,6 +1861,7 @@ options CLUSTERDEBUG
|
||||
options COMPAT_LINUX
|
||||
options CPU_UPGRADE_HW_CACHE
|
||||
options DEBUG
|
||||
options DEBUG_VFS_LOCKS
|
||||
options "DEBUG_1284"
|
||||
#options DISABLE_PSE
|
||||
options "EXT2FS"
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.537 1999/01/19 15:11:46 des Exp $
|
||||
# $Id: LINT,v 1.538 1999/01/20 03:29:51 msmith Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -1844,6 +1844,14 @@ options "PMAP_SHPGPERPROC=201"
|
||||
#
|
||||
options "NSFBUFS=1024"
|
||||
|
||||
#
|
||||
# Enable extra debugging code for locks. This include storing the
|
||||
# filename and line of whatever aquired the lock in the lock itself,
|
||||
# and changing a number of function calls to pass around the relevant
|
||||
# data. This is not at all useful unless you are debugging lock code.
|
||||
#
|
||||
options DEBUG_LOCKS
|
||||
|
||||
# More undocumented options for linting.
|
||||
|
||||
options CLK_CALIBRATION_LOOP
|
||||
@ -1853,6 +1861,7 @@ options CLUSTERDEBUG
|
||||
options COMPAT_LINUX
|
||||
options CPU_UPGRADE_HW_CACHE
|
||||
options DEBUG
|
||||
options DEBUG_VFS_LOCKS
|
||||
options "DEBUG_1284"
|
||||
#options DISABLE_PSE
|
||||
options "EXT2FS"
|
||||
|
@ -38,7 +38,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_lock.c 8.18 (Berkeley) 5/21/95
|
||||
* $Id: kern_lock.c,v 1.21 1999/01/08 17:31:08 eivind Exp $
|
||||
* $Id: kern_lock.c,v 1.22 1999/01/10 01:58:24 eivind Exp $
|
||||
*/
|
||||
|
||||
#include "opt_lint.h"
|
||||
@ -171,11 +171,20 @@ acquire(struct lock *lkp, int extflags, int wanted) {
|
||||
* accepted shared locks and shared-to-exclusive upgrades to go away.
|
||||
*/
|
||||
int
|
||||
#ifndef DEBUG_LOCKS
|
||||
lockmgr(lkp, flags, interlkp, p)
|
||||
#else
|
||||
debuglockmgr(lkp, flags, interlkp, p, name, file, line)
|
||||
#endif
|
||||
struct lock *lkp;
|
||||
u_int flags;
|
||||
struct simplelock *interlkp;
|
||||
struct proc *p;
|
||||
#ifdef DEBUG_LOCKS
|
||||
const char *name; /* Name of lock function */
|
||||
const char *file; /* Name of file call is from */
|
||||
int line; /* Line number in file */
|
||||
#endif
|
||||
{
|
||||
int error;
|
||||
pid_t pid;
|
||||
@ -283,6 +292,11 @@ lockmgr(lkp, flags, interlkp, p)
|
||||
panic("lockmgr: non-zero exclusive count");
|
||||
#endif
|
||||
lkp->lk_exclusivecount = 1;
|
||||
#if defined(DEBUG_LOCKS)
|
||||
lkp->lk_filename = file;
|
||||
lkp->lk_lineno = line;
|
||||
lkp->lk_lockername = name;
|
||||
#endif
|
||||
COUNT(p, 1);
|
||||
break;
|
||||
}
|
||||
@ -338,6 +352,11 @@ lockmgr(lkp, flags, interlkp, p)
|
||||
panic("lockmgr: non-zero exclusive count");
|
||||
#endif
|
||||
lkp->lk_exclusivecount = 1;
|
||||
#if defined(DEBUG_LOCKS)
|
||||
lkp->lk_filename = file;
|
||||
lkp->lk_lineno = line;
|
||||
lkp->lk_lockername = name;
|
||||
#endif
|
||||
COUNT(p, 1);
|
||||
break;
|
||||
|
||||
@ -383,6 +402,11 @@ lockmgr(lkp, flags, interlkp, p)
|
||||
lkp->lk_flags |= LK_DRAINING | LK_HAVE_EXCL;
|
||||
lkp->lk_lockholder = pid;
|
||||
lkp->lk_exclusivecount = 1;
|
||||
#if defined(DEBUG_LOCKS)
|
||||
lkp->lk_filename = file;
|
||||
lkp->lk_lineno = line;
|
||||
lkp->lk_lockername = name;
|
||||
#endif
|
||||
COUNT(p, 1);
|
||||
break;
|
||||
|
||||
|
@ -205,7 +205,12 @@ vop_stdlock(ap)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef DEBUG_LOCKS
|
||||
return (lockmgr(l, ap->a_flags, &ap->a_vp->v_interlock, ap->a_p));
|
||||
#else
|
||||
return (debuglockmgr(l, ap->a_flags, &ap->a_vp->v_interlock, ap->a_p,
|
||||
"vop_stdlock", ap->a_vp->filename, ap->a_vp->line));
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
@ -355,7 +360,12 @@ vop_sharedlock(ap)
|
||||
}
|
||||
if (flags & LK_INTERLOCK)
|
||||
vnflags |= LK_INTERLOCK;
|
||||
return(lockmgr(vp->v_vnlock, vnflags, &vp->v_interlock, ap->a_p));
|
||||
#ifndef DEBUG_LOCKS
|
||||
return (lockmgr(vp->v_vnlock, vnflags, &vp->v_interlock, ap->a_p));
|
||||
#else
|
||||
return (debuglockmgr(vp->v_vnlock, vnflags, &vp->v_interlock, ap->a_p,
|
||||
"vop_sharedlock", vp->filename, vp->line));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94
|
||||
* $Id: vfs_vnops.c,v 1.60 1998/11/02 02:36:16 peter Exp $
|
||||
* $Id: vfs_vnops.c,v 1.61 1999/01/05 18:49:56 eivind Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -510,10 +510,18 @@ vn_poll(fp, events, cred, p)
|
||||
* acquire requested lock.
|
||||
*/
|
||||
int
|
||||
#ifndef DEBUG_LOCKS
|
||||
vn_lock(vp, flags, p)
|
||||
#else
|
||||
debug_vn_lock(vp, flags, p, filename, line)
|
||||
#endif
|
||||
struct vnode *vp;
|
||||
int flags;
|
||||
struct proc *p;
|
||||
#ifdef DEBUG_LOCKS
|
||||
const char *filename;
|
||||
int line;
|
||||
#endif
|
||||
{
|
||||
int error;
|
||||
|
||||
@ -526,7 +534,12 @@ vn_lock(vp, flags, p)
|
||||
tsleep((caddr_t)vp, PINOD, "vn_lock", 0);
|
||||
error = ENOENT;
|
||||
} else {
|
||||
error = VOP_LOCK(vp, flags | LK_NOPAUSE | LK_INTERLOCK, p);
|
||||
#ifdef DEBUG_LOCKS
|
||||
vp->filename = filename;
|
||||
vp->line = line;
|
||||
#endif
|
||||
error = VOP_LOCK(vp,
|
||||
flags | LK_NOPAUSE | LK_INTERLOCK, p);
|
||||
if (error == 0)
|
||||
return (error);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)lock.h 8.12 (Berkeley) 5/19/95
|
||||
* $Id: lock.h,v 1.11 1998/01/06 05:22:48 dyson Exp $
|
||||
* $Id: lock.h,v 1.12 1999/01/02 11:34:56 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LOCK_H_
|
||||
@ -59,6 +59,11 @@ struct lock {
|
||||
char *lk_wmesg; /* resource sleeping (for tsleep) */
|
||||
int lk_timo; /* maximum sleep time (for tsleep) */
|
||||
pid_t lk_lockholder; /* pid of exclusive lock holder */
|
||||
#ifdef DEBUG_LOCKS
|
||||
const char *lk_filename;
|
||||
const char *lk_lockername;
|
||||
int lk_lineno;
|
||||
#endif
|
||||
};
|
||||
/*
|
||||
* Lock request types:
|
||||
@ -169,8 +174,19 @@ struct proc;
|
||||
|
||||
void lockinit __P((struct lock *, int prio, char *wmesg, int timo,
|
||||
int flags));
|
||||
#ifdef DEBUG_LOCKS
|
||||
int debuglockmgr __P((struct lock *, u_int flags,
|
||||
struct simplelock *, struct proc *p,
|
||||
const char *,
|
||||
const char *,
|
||||
int));
|
||||
#define lockmgr(lockp, flags, slockp, proc) \
|
||||
debuglockmgr((lockp), (flags), (slockp), (proc), \
|
||||
"lockmgr", __FILE__, __LINE__)
|
||||
#else
|
||||
int lockmgr __P((struct lock *, u_int flags,
|
||||
struct simplelock *, struct proc *p));
|
||||
#endif
|
||||
void lockmgr_printinfo __P((struct lock *));
|
||||
int lockstatus __P((struct lock *));
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)lock.h 8.12 (Berkeley) 5/19/95
|
||||
* $Id: lock.h,v 1.11 1998/01/06 05:22:48 dyson Exp $
|
||||
* $Id: lock.h,v 1.12 1999/01/02 11:34:56 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LOCK_H_
|
||||
@ -59,6 +59,11 @@ struct lock {
|
||||
char *lk_wmesg; /* resource sleeping (for tsleep) */
|
||||
int lk_timo; /* maximum sleep time (for tsleep) */
|
||||
pid_t lk_lockholder; /* pid of exclusive lock holder */
|
||||
#ifdef DEBUG_LOCKS
|
||||
const char *lk_filename;
|
||||
const char *lk_lockername;
|
||||
int lk_lineno;
|
||||
#endif
|
||||
};
|
||||
/*
|
||||
* Lock request types:
|
||||
@ -169,8 +174,19 @@ struct proc;
|
||||
|
||||
void lockinit __P((struct lock *, int prio, char *wmesg, int timo,
|
||||
int flags));
|
||||
#ifdef DEBUG_LOCKS
|
||||
int debuglockmgr __P((struct lock *, u_int flags,
|
||||
struct simplelock *, struct proc *p,
|
||||
const char *,
|
||||
const char *,
|
||||
int));
|
||||
#define lockmgr(lockp, flags, slockp, proc) \
|
||||
debuglockmgr((lockp), (flags), (slockp), (proc), \
|
||||
"lockmgr", __FILE__, __LINE__)
|
||||
#else
|
||||
int lockmgr __P((struct lock *, u_int flags,
|
||||
struct simplelock *, struct proc *p));
|
||||
#endif
|
||||
void lockmgr_printinfo __P((struct lock *));
|
||||
int lockstatus __P((struct lock *));
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
|
||||
* $Id: vnode.h,v 1.78 1998/11/10 09:04:09 peter Exp $
|
||||
* $Id: vnode.h,v 1.79 1999/01/05 18:50:01 eivind Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VNODE_H_
|
||||
@ -125,6 +125,10 @@ struct vnode {
|
||||
short vpi_events; /* what they are looking for */
|
||||
short vpi_revents; /* what has happened */
|
||||
} v_pollinfo;
|
||||
#ifdef DEBUG_LOCKS
|
||||
const char *filename; /* Source file doing locking */
|
||||
int line; /* Line number doing locking */
|
||||
#endif
|
||||
};
|
||||
#define v_mountedhere v_un.vu_mountedhere
|
||||
#define v_socket v_un.vu_socket
|
||||
@ -505,6 +509,11 @@ int vrecycle __P((struct vnode *vp, struct simplelock *inter_lkp,
|
||||
int vn_close __P((struct vnode *vp,
|
||||
int flags, struct ucred *cred, struct proc *p));
|
||||
int vn_lock __P((struct vnode *vp, int flags, struct proc *p));
|
||||
#ifdef DEBUG_LOCKS
|
||||
int debug_vn_lock __P((struct vnode *vp, int flags, struct proc *p,
|
||||
const char *filename, int line));
|
||||
#define vn_lock(vp,flags,p) debug_vn_lock(vp,flags,p,__FILE__,__LINE__)
|
||||
#endif
|
||||
int vn_open __P((struct nameidata *ndp, int fmode, int cmode));
|
||||
void vn_pollevent __P((struct vnode *vp, int events));
|
||||
void vn_pollgone __P((struct vnode *vp));
|
||||
|
Loading…
Reference in New Issue
Block a user