Index: subr_turnstile.c =================================================================== RCS file: /usr/cvs/src/sys/kern/subr_turnstile.c,v retrieving revision 1.156 diff -u -r1.156 subr_turnstile.c --- subr_turnstile.c 27 Jan 2006 22:42:12 -0000 1.156 +++ subr_turnstile.c 29 Mar 2006 21:24:02 -0000 @@ -186,15 +186,21 @@ MPASS(td->td_proc->p_magic == P_MAGIC); /* - * XXX: The owner of a turnstile can be stale if it is the - * first thread to grab a rlock of a rw lock. In that case - * it is possible for us to be at SSLEEP or some other - * weird state. We should probably just return if the state - * isn't SRUN or SLOCK. + * If the thread is asleep, then we are probably about + * to deadlock. To make debugging this easier, just + * panic and tell the user which thread misbehaved so + * they can hopefully get a stack trace from the truly + * misbehaving thread. */ - KASSERT(!TD_IS_SLEEPING(td), - ("sleeping thread (tid %d) owns a non-sleepable lock", - td->td_tid)); + if (TD_IS_SLEEPING(td)) { + printf( + "Sleeping thread (tid %d, pid %d) owns a non-sleepable lock\n", + td->td_tid, td->td_proc->p_pid); +#ifdef DDB + db_trace_thread(td, -1); +#endif + panic("b00m"); + } /* * If this thread already has higher priority than the