Re: libzpool assert vs libc assert

From: Andriy Gapon <avg_at_freebsd.org>
Date: Tue, 02 Jun 2009 17:06:18 +0300
on 01/06/2009 19:22 Andriy Gapon said the following:
> Henri,
> 
> thank you very much for testing!
> It look like the patch did its job.
> 
> P.S. hopefully someone is looking into the cause of the assertion.

I think I cracked it.
This is where ds->ds_lock.m_owner gets corrupted:
(gdb) c
Continuing.
Watchpoint 8: *(void **) 34385649856

Old value = (void *) 0x0
New value = (void *) 0x8018f7ce0
0x0000000800a731e6 in pthread_mutexattr_init () from /lib/libthr.so.3
(gdb) bt
#0  0x0000000800a731e6 in pthread_mutexattr_init () from /lib/libthr.so.3
#1  0x0000000800a733ca in pthread_mutex_getyieldloops_np () from /lib/libthr.so.3
#2  0x0000000800a736ab in pthread_mutex_isowned_np () from /lib/libthr.so.3
#3  0x00000008010398e5 in dsl_dataset_evict (db=0x8018c7cf0, dsv=0x8018b6000) at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c:264
...
(gdb) fr 3
#3  0x00000008010398e5 in dsl_dataset_evict (db=0x8018c7cf0, dsv=0x8018b6000) at
/usr/src/cddl/lib/libzpool/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c:264
264             if (mutex_owned(&ds->ds_lock))
(gdb) list
259             if (ds->ds_dir)
260                     dsl_dir_close(ds->ds_dir, ds);
261
262             ASSERT(!list_link_active(&ds->ds_synced_link));
263
264             if (mutex_owned(&ds->ds_lock))
265                     mutex_exit(&ds->ds_lock);


mutex_owned is defined:
cddl/contrib/opensolaris/head/thread.h
#define  mutex_owned(l)          pthread_mutex_isowned_np(l)

So we pass kmutex_t* parameter to pthread_mutex_isowned_np call where in fact we
should be passing pthread_mutex_t* parameter.

So I am quite sure that mutex_owned should be defined as follows:
#define  mutex_owned(l)          pthread_mutex_isowned_np((l)->m_lock)

Or it should be called on m_lock member of kmutex_t.

Thanks to Henri for all the debugging info!

-- 
Andriy Gapon
Received on Tue Jun 02 2009 - 12:06:24 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:49 UTC