[zfs-code] Read-write locks in libzpool

2006-06-09 Thread Ricardo Correia
Ok, I took a look at the libc and the kernel implementation of rwlocks. I'm a little worried if I got this right, because most of the ZFS code can run both in userspace and in the kernel, which seem to behave differently in the RW_xxx_HELD() macros, and I need to port it correctly. This is what

[zfs-code] Read-write locks in libzpool

2006-06-08 Thread Mark Shellenbaum
Ricardo Correia wrote: > Ok, I took a look at the libc and the kernel implementation of rwlocks. > > I'm a little worried if I got this right, because most of the ZFS code can > run > both in userspace and in the kernel, which seem to behave differently in the > RW_xxx_HELD() macros, and I nee

[zfs-code] Read-write locks in libzpool

2006-06-06 Thread Jonathan Adams
On Fri, Jun 02, 2006 at 05:50:21AM +0100, Ricardo Correia wrote: > On Friday 02 June 2006 05:12, Neil Perrin wrote: > > I believe RW_LOCK_HELD checks it's not held by the calling thread only. > > Note, a thread should not doubly read lock the same lock as > > a write lock from another thread betwee

[zfs-code] Read-write locks in libzpool

2006-06-02 Thread Ricardo Correia
On Friday 02 June 2006 05:12, Neil Perrin wrote: > I believe RW_LOCK_HELD checks it's not held by the calling thread only. > Note, a thread should not doubly read lock the same lock as > a write lock from another thread between the 2 would deadlock. Ok, that makes sense. Thanks :) I'm assuming RW

[zfs-code] Read-write locks in libzpool

2006-06-02 Thread Ricardo Correia
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 != curthr

[zfs-code] Read-write locks in libzpool

2006-06-01 Thread Neil Perrin
I believe RW_LOCK_HELD checks it's not held by the calling thread only. Note, a thread should not doubly read lock the same lock as a write lock from another thread between the 2 would deadlock. Ricardo Correia wrote On 06/01/06 22:03,: > Hi, > > I think I found a bug in the rw_enter() implementa