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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user