--- /usr/src/sys/kern/kern_lock.c Sun Jan 13 17:11:54 2008 +++ kern/kern_lock.c Wed Jan 16 20:47:58 2008 @@ -105,7 +105,12 @@ panic("lockmgr locks do not support sleep interlocking"); } -#define COUNT(td, x) ((td)->td_locks += (x)) +#define COUNT(td, x) do { \ + CTR2(KTR_SPARE2, "thread %p bumping locks of %d", (td), \ + (x)); \ + (td)->td_locks += (x); \ +} while (0) + #define LK_ALL (LK_HAVE_EXCL | LK_WANT_EXCL | LK_WANT_UPGRADE | \ LK_SHARE_NONZERO | LK_WAIT_NONZERO) @@ -555,8 +560,10 @@ * owner can be alredy KERNPROC, so in that case just skip the * decrement. */ - if (lkp->lk_lockholder == td) + if (lkp->lk_lockholder == td) { + CTR1(KTR_SPARE2, "thread %p bumping locks of -1", td); td->td_locks--; + } lkp->lk_lockholder = LK_KERNPROC; }