Fix a sign bug that caused adaptive spinning in sx_xlock() to not work

properly.  Among other things it did not drop Giant while spinning
leading to livelocks.

Reviewed by:	rookie, kib, jmallett
MFC after:	3 days
This commit is contained in:
John Baldwin 2010-06-08 16:17:47 +00:00
parent 82b361b11b
commit 8545538b6a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208912

View File

@ -511,7 +511,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t tid, int opts, const char *file,
* running or the state of the lock changes.
*/
x = sx->sx_lock;
if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) != 0) {
if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
if ((x & SX_LOCK_SHARED) == 0) {
x = SX_OWNER(x);
owner = (struct thread *)x;