kernel: Fix acquire_read_spinlock() acquire checks

If the initial attempt to acquire read spinlock fails we use more relaxed
loop (which doesn't require CPU to lock the bus). However, check in that
loop, incorrectly, didn't allow a lock to be acquired when there was at
least one other reader.
This commit is contained in:
Pawel Dziepak
2014-02-27 02:21:13 +01:00
parent 8cdefee93f
commit e31212e4d7
+1 -1
View File
@@ -637,7 +637,7 @@ acquire_read_spinlock(rw_spinlock* lock)
if (try_acquire_read_spinlock(lock))
break;
while (atomic_get(&lock->lock) != 0) {
while ((atomic_get(&lock->lock) & (1u << 31)) != 0) {
if (++count == SPINLOCK_DEADLOCK_COUNT) {
panic("acquire_read_spinlock(): Failed to acquire spinlock %p "
"for a long time!", lock);