Hi, I think I found a bug in the rw_enter() implementation (emulation?) in libzpool, file /usr/src/lib/libzpool/common/kernel.c:
void rw_enter(krwlock_t *rwlp, krw_t rw) { ASSERT(!RW_LOCK_HELD(rwlp)); ASSERT(rwlp->rw_owner != (void *)-1UL); ASSERT(rwlp->rw_owner != curthread); if (rw == RW_READER) (void) rw_rdlock(&rwlp->rw_lock); else (void) rw_wrlock(&rwlp->rw_lock); rwlp->rw_owner = curthread; } Doesn't RW_LOCK_HELD() check if there's a reader or a writer locked? If it does, then these read-write locks would produce an assertion when multiple readers tried to lock it. However, RW_LOCK_HELD() is being applied to "rwlp" instead of "&rwlp->rw_lock", which could explain why it's not failing. Am I understanding this correctly? Unfortunately POSIX threads don't have an equivalent of rw_lock_held(), rw_write_held(), mutex_held(), ..., so I really have to understand this in order to somehow emulate their behavior. Thanks!