diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2006-05-07 20:12:42 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2006-05-07 20:12:42 +0000 |
commit | 5b458e8d496bd0cdc94f0ec7a9ff9ae741d961ed (patch) | |
tree | 6159b73e9e098b39bf803a6b9e74326ab3bc1345 | |
parent | 4a02f1bb86ffaf58c243035d5c3117d4611db8eb (diff) |
add a name to rwlock so that we can tell where procs are getting stuck
without breaking into ddb. doubles the size of rwlock [1], but moving
forward this really helps. ok/tested pedro fgsch millert krw
[1 - next person to add a field to this struct gets whipped with a wet noodle]
-rw-r--r-- | sys/dev/ic/aacvar.h | 4 | ||||
-rw-r--r-- | sys/kern/kern_descrip.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_rwlock.c | 7 | ||||
-rw-r--r-- | sys/nfs/nfs_node.c | 4 | ||||
-rw-r--r-- | sys/sys/rwlock.h | 5 |
5 files changed, 13 insertions, 11 deletions
diff --git a/sys/dev/ic/aacvar.h b/sys/dev/ic/aacvar.h index 4a9dbf3c660..792df3e80ae 100644 --- a/sys/dev/ic/aacvar.h +++ b/sys/dev/ic/aacvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: aacvar.h,v 1.6 2006/04/22 02:36:26 brad Exp $ */ +/* $OpenBSD: aacvar.h,v 1.7 2006/05/07 20:12:41 tedu Exp $ */ /*- * Copyright (c) 2000 Michael Smith @@ -218,7 +218,7 @@ extern struct aac_interface aac_rkt_interface; /* Define the OS version specific locks */ typedef struct rwlock aac_lock_t; #define AAC_LOCK_INIT(l, s) do { \ - rw_init((l)); \ + rw_init((l), "aaclock"); \ AAC_DPRINTF(AAC_D_LOCK, ("%s: init lock @%s: %d\n", \ sc->aac_dev.dv_xname, __FUNCTION__, __LINE__)); \ } while (0) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index b4cadf9cbae..e41013a29b0 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.73 2006/01/06 18:28:33 jmc Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.74 2006/05/07 20:12:41 tedu Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -847,7 +847,7 @@ fdinit(struct proc *p) if (newfdp->fd_fd.fd_rdir) VREF(newfdp->fd_fd.fd_rdir); } - rw_init(&newfdp->fd_fd.fd_lock); + rw_init(&newfdp->fd_fd.fd_lock, "fdlock"); /* Create the file descriptor table. */ newfdp->fd_fd.fd_refcnt = 1; diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 1a648aa831b..4c750a2f2f6 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_rwlock.c,v 1.6 2006/04/20 14:36:24 pedro Exp $ */ +/* $OpenBSD: kern_rwlock.c,v 1.7 2006/05/07 20:12:41 tedu Exp $ */ /* * Copyright (c) 2002, 2003 Artur Grabowski <art@openbsd.org> @@ -198,9 +198,10 @@ rw_exit_diag(struct rwlock *rwl, int owner) #endif void -rw_init(struct rwlock *rwl) +rw_init(struct rwlock *rwl, const char *name) { rwl->rwl_owner = 0; + rwl->rwl_name = name; } /* @@ -230,7 +231,7 @@ retry: rw_enter_diag(rwl, flags); - if ((error = tsleep(rwl, prio, "rwlock", 0)) != 0) + if ((error = tsleep(rwl, prio, rwl->rwl_name, 0)) != 0) return (error); if (flags & RW_SLEEPFAIL) return (EAGAIN); diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c index e74d17a39bb..934b9d0bb5f 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_node.c,v 1.31 2006/01/09 12:43:16 pedro Exp $ */ +/* $OpenBSD: nfs_node.c,v 1.32 2006/05/07 20:12:41 tedu Exp $ */ /* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */ /* @@ -128,7 +128,7 @@ loop: vp->v_data = np; np->n_vnode = vp; - rw_init(&np->n_commitlock); + rw_init(&np->n_commitlock, "nfs_commitlk"); /* * Are we getting the root? If so, make sure the vnode flags diff --git a/sys/sys/rwlock.h b/sys/sys/rwlock.h index 4b8823b7ea1..903ad9bf360 100644 --- a/sys/sys/rwlock.h +++ b/sys/sys/rwlock.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rwlock.h,v 1.5 2006/01/06 06:50:31 tedu Exp $ */ +/* $OpenBSD: rwlock.h,v 1.6 2006/05/07 20:12:41 tedu Exp $ */ /* * Copyright (c) 2002 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -73,6 +73,7 @@ struct proc; struct rwlock { __volatile unsigned long rwl_owner; + const char *rwl_name; }; #define RWLOCK_INITIALIZER { 0 } @@ -87,7 +88,7 @@ struct rwlock { #define RWLOCK_READER_SHIFT 3UL #define RWLOCK_READ_INCR (1UL << RWLOCK_READER_SHIFT) -void rw_init(struct rwlock *); +void rw_init(struct rwlock *, const char *); void rw_enter_read(struct rwlock *); void rw_enter_write(struct rwlock *); |