mutex_vector_enter: put a read memory barrier between the final check that
(1) the holder is no longer running and (2) the waiters bit is set. Needed to ensure that the operations happen in the correct order.
This commit is contained in:
parent
194273271b
commit
bf8c3c1d7b
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_mutex.c,v 1.12 2007/03/12 02:19:14 matt Exp $ */
|
||||
/* $NetBSD: kern_mutex.c,v 1.13 2007/03/12 22:34:08 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
@ -49,7 +49,7 @@
|
||||
#define __MUTEX_PRIVATE
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.12 2007/03/12 02:19:14 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.13 2007/03/12 22:34:08 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
@ -646,8 +646,8 @@ mutex_vector_enter(kmutex_t *mtx)
|
||||
* If the waiters bit is not set it's unsafe to go asleep,
|
||||
* as we might never be awoken.
|
||||
*/
|
||||
mb_read();
|
||||
if (mutex_onproc(owner, &ci) || !MUTEX_HAS_WAITERS(mtx)) {
|
||||
if ((mb_read(), mutex_onproc(owner, &ci)) ||
|
||||
(mb_read(), !MUTEX_HAS_WAITERS(mtx))) {
|
||||
turnstile_exit(mtx);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user