Index: sys/kern/subr_witness.c =================================================================== --- sys/kern/subr_witness.c +++ sys/kern/subr_witness.c @@ -1850,11 +1850,13 @@ found: w->w_refcount++; mtx_unlock_spin(&w_mtx); - if (lock_class != w->w_class) + if (w->w_refcount == 1) + w->w_class = lock_class; + else if (lock_class != w->w_class) kassert_panic( - "lock (%s) %s does not match earlier (%s) lock", - description, lock_class->lc_name, - w->w_class->lc_name); + "lock (%s) %s does not match earlier (%s) lock", + description, lock_class->lc_name, + w->w_class->lc_name); return (w); }