diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-07-02 08:58:17 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-07-02 08:58:17 +0000 |
commit | ec152b9d201c5e62fc010e5eef7da07408c5ef9a (patch) | |
tree | 4878984230a0a589fb603b44068cc15866bb6869 /sys/arch | |
parent | 8fe11c7654c1620c34b16e8c4fe379ba645a4059 (diff) |
copy MUTEX_ASSERT_LOCKED and MUTEX_ASSERT_UNLOCKED from alpha.
the previous asserts checked if the mutex was locked by any cpu or
not when they should have been checking if the current cpu has the
lock or not.
found by miod after i enabled pool_gc again.
ok miod@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/m88k/include/mutex.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/arch/m88k/include/mutex.h b/sys/arch/m88k/include/mutex.h index 1c5413abab3..726a02c77e8 100644 --- a/sys/arch/m88k/include/mutex.h +++ b/sys/arch/m88k/include/mutex.h @@ -1,6 +1,6 @@ #ifndef _M88K_MUTEX_H_ #define _M88K_MUTEX_H_ -/* $OpenBSD: mutex.h,v 1.2 2014/02/02 20:31:10 kettenis Exp $ */ +/* $OpenBSD: mutex.h,v 1.3 2015/07/02 08:58:16 dlg Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. @@ -55,15 +55,13 @@ void __mtx_init(struct mutex *, int); #ifdef DIAGNOSTIC -#define MUTEX_ASSERT_LOCKED(mtx) \ -do { \ - if ((mtx)->mtx_lock == 0 || (mtx)->mtx_cpu != curcpu()) \ +#define MUTEX_ASSERT_LOCKED(mtx) do { \ + if ((mtx)->mtx_owner != curcpu()) \ panic("mutex %p not held in %s", (mtx), __func__); \ } while (0) -#define MUTEX_ASSERT_UNLOCKED(mtx) \ -do { \ - if ((mtx)->mtx_lock != 0) \ +#define MUTEX_ASSERT_UNLOCKED(mtx) do { \ + if ((mtx)->mtx_owner == curcpu()) \ panic("mutex %p held in %s", (mtx), __func__); \ } while (0) |