Threads holding a read lock of a sleepable rm lock are not permitted
to sleep. The rmlock implementation enforces this by disabling sleeping when a read lock is acquired. To simplify the implementation, sleeping is disabled for most of the duration of rm_rlock. However, it doesn't need to be disabled until the lock is acquired. If a sleepable rm lock is contested, then rm_rlock may need to acquire the backing sx lock. This tripped the overly-broad assertion. Fix by relaxing the assertion around the call to sx_xlock(). Reported by: mjg Reviewed by: kib, mjg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3324
This commit is contained in:
parent
32f63fe59a
commit
d7f36d77c9
@ -407,9 +407,11 @@ _rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock)
|
||||
return (0);
|
||||
}
|
||||
} else {
|
||||
if (rm->lock_object.lo_flags & LO_SLEEPABLE)
|
||||
if (rm->lock_object.lo_flags & LO_SLEEPABLE) {
|
||||
THREAD_SLEEPING_OK();
|
||||
sx_xlock(&rm->rm_lock_sx);
|
||||
else
|
||||
THREAD_NO_SLEEPING();
|
||||
} else
|
||||
mtx_lock(&rm->rm_lock_mtx);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user