From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 20:22:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9F161065670; Thu, 9 Jul 2009 20:22:05 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BBDF8FC14; Thu, 9 Jul 2009 20:22:05 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69KM5Nn096181; Thu, 9 Jul 2009 20:22:05 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69KM5Pq096177; Thu, 9 Jul 2009 20:22:05 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200907092022.n69KM5Pq096177@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Jul 2009 20:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195515 - in head/cddl/contrib/opensolaris: head lib/libzpool/common lib/libzpool/common/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jul 2009 20:22:06 -0000 Author: pjd Date: Thu Jul 9 20:22:05 2009 New Revision: 195515 URL: http://svn.freebsd.org/changeset/base/195515 Log: The mutex_owned() macro should operate on kmutex_t and not on mutex_t. This fixes 'zdb ' crash. Reported by: avg Approved by: re (kib) Modified: head/cddl/contrib/opensolaris/head/thread.h head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Modified: head/cddl/contrib/opensolaris/head/thread.h ============================================================================== --- head/cddl/contrib/opensolaris/head/thread.h Thu Jul 9 20:16:01 2009 (r195514) +++ head/cddl/contrib/opensolaris/head/thread.h Thu Jul 9 20:22:05 2009 (r195515) @@ -53,7 +53,6 @@ typedef pthread_rwlock_t rwlock_t; #define mutex_lock(l) pthread_mutex_lock(l) #define mutex_trylock(l) pthread_mutex_trylock(l) #define mutex_unlock(l) pthread_mutex_unlock(l) -#define mutex_owned(l) pthread_mutex_isowned_np(l) #define rwlock_init(l,f,a) pthread_rwlock_init(l,NULL) #define rwlock_destroy(l) pthread_rwlock_destroy(l) #define rw_rdlock(l) pthread_rwlock_rdlock(l) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Thu Jul 9 20:16:01 2009 (r195514) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Thu Jul 9 20:22:05 2009 (r195515) @@ -115,6 +115,14 @@ zmutex_destroy(kmutex_t *mp) mp->initialized = B_FALSE; } +int +zmutex_owned(kmutex_t *mp) +{ + ASSERT(mp->initialized == B_TRUE); + + return (mp->m_owner == curthread); +} + void mutex_enter(kmutex_t *mp) { Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jul 9 20:16:01 2009 (r195514) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jul 9 20:22:05 2009 (r195515) @@ -237,9 +237,11 @@ typedef struct kmutex { #define mutex_init(mp, b, c, d) zmutex_init((kmutex_t *)(mp)) #define mutex_destroy(mp) zmutex_destroy((kmutex_t *)(mp)) +#define mutex_owned(mp) zmutex_owned((kmutex_t *)(mp)) extern void zmutex_init(kmutex_t *mp); extern void zmutex_destroy(kmutex_t *mp); +extern int zmutex_owned(kmutex_t *mp); extern void mutex_enter(kmutex_t *mp); extern void mutex_exit(kmutex_t *mp); extern int mutex_tryenter(kmutex_t *mp);