svn commit: r326112 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Thu Nov 23 03:40:52 UTC 2017
Author: mjg
Date: Thu Nov 23 03:40:51 2017
New Revision: 326112
URL: https://svnweb.freebsd.org/changeset/base/326112
Log:
sx: unbreak debug after r326107
An assertion was modified to use the found value, but it was not updated to
handle a race where blocked threads appear after the entrance to the func.
Move the assertion down to the area protected with sleepq lock where the
lock is read anyway. This does not affect coverage of the assertion and
is consistent with what rw locks are doing.
Reported by: Shawn Webb
Modified:
head/sys/kern/kern_sx.c
Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c Thu Nov 23 03:20:12 2017 (r326111)
+++ head/sys/kern/kern_sx.c Thu Nov 23 03:40:51 2017 (r326112)
@@ -828,12 +828,12 @@ _sx_xunlock_hard(struct sx *sx, uintptr_t x LOCK_FILE_
atomic_cmpset_rel_ptr(&sx->sx_lock, tid, SX_LOCK_UNLOCKED))
return;
- MPASS(x & (SX_LOCK_SHARED_WAITERS | SX_LOCK_EXCLUSIVE_WAITERS));
if (LOCK_LOG_TEST(&sx->lock_object, 0))
CTR2(KTR_LOCK, "%s: %p contested", __func__, sx);
sleepq_lock(&sx->lock_object);
x = SX_READ_VALUE(sx);
+ MPASS(x & (SX_LOCK_SHARED_WAITERS | SX_LOCK_EXCLUSIVE_WAITERS));
/*
* The wake up algorithm here is quite simple and probably not
More information about the svn-src-all
mailing list