Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Assert that no locks are held if we're called with ...



details:   https://anonhg.NetBSD.org/src/rev/40af46e6c475
branches:  trunk
changeset: 510709:40af46e6c475
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jun 05 04:40:39 2001 +0000

description:
Assert that no locks are held if we're called with PR_WAITOK.
>From Bill Sommerfeld.

diffstat:

 sys/kern/subr_pool.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r 8d67e614c13e -r 40af46e6c475 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Tue Jun 05 04:39:56 2001 +0000
+++ b/sys/kern/subr_pool.c      Tue Jun 05 04:40:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.57 2001/05/13 17:17:35 sommerfeld Exp $        */
+/*     $NetBSD: subr_pool.c,v 1.58 2001/06/05 04:40:39 thorpej Exp $   */
 
 /*-
  * Copyright (c) 1997, 1999, 2000 The NetBSD Foundation, Inc.
@@ -592,7 +592,12 @@
        if (__predict_false(curproc == NULL && doing_shutdown == 0 &&
                            (flags & PR_WAITOK) != 0))
                panic("pool_get: must have NOWAIT");
+
+#ifdef LOCKDEBUG
+       if (flags & PR_WAITOK)
+               simple_lock_only_held(NULL, "pool_get(PR_WAITOK)");
 #endif
+#endif /* DIAGNOSTIC */
 
        simple_lock(&pp->pr_slock);
        pr_enter(pp, file, line);
@@ -953,7 +958,7 @@
        simple_unlock(&pp->pr_slock);
 }
 #undef pool_put
-#endif
+#endif /* DIAGNOSTIC */
 
 void
 pool_put(struct pool *pp, void *v)
@@ -1634,6 +1639,11 @@
        struct pool_cache_group *pcg;
        void *object;
 
+#ifdef LOCKDEBUG
+       if (flags & PR_WAITOK)
+               simple_lock_only_held(NULL, "pool_cache_get(PR_WAITOK)");
+#endif
+
        simple_lock(&pc->pc_slock);
 
        if ((pcg = pc->pc_allocfrom) == NULL) {



Home | Main Index | Thread Index | Old Index