Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Jun 2009 17:06:18 +0300
From:      Andriy Gapon <avg@freebsd.org>
To:        Henri Hennebert <hlh@restart.be>, Kip Macy <kmacy@freebsd.org>
Cc:        freebsd-current@freebsd.org, freebsd-stable@freebsd.org
Subject:   Re: libzpool assert vs libc assert
Message-ID:  <4A2531DA.2070608@freebsd.org>
In-Reply-To: <4A240063.207@freebsd.org>
References:  <3c1674c90905201643m540c8b1v8a8bd88f071c233d@mail.gmail.com>		<4A1D0F2B.4030006@restart.be>		<ed91d4a80905271104g2a824d0fna004d1c4f3126c67@mail.gmail.com>	<3c1674c90905280052q281f6172j2409fe2d64db6914@mail.gmail.com> <4A1E90F7.2000000@restart.be> <4A1E97D8.4080901@icyb.net.ua> <4A1FD687.5070502@freebsd.org> <4A23EEC8.2040208@freebsd.org> <4A23FDE5.1040101@restart.be> <4A240063.207@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A2531DA.2070608>