When releasing a lockmgr held in shared way we need to use a write memory
barrier in order to avoid, on architectures which doesn't have strong ordered writes, CPU instructions reordering. Diagnosed by: fabio
This commit is contained in:
parent
bba017d6a0
commit
7f9f80ce03
@ -241,7 +241,7 @@ wakeupshlk(struct lock *lk, const char *file, int line)
|
||||
* and return.
|
||||
*/
|
||||
if (LK_SHARERS(x) > 1) {
|
||||
if (atomic_cmpset_ptr(&lk->lk_lock, x,
|
||||
if (atomic_cmpset_rel_ptr(&lk->lk_lock, x,
|
||||
x - LK_ONE_SHARER))
|
||||
break;
|
||||
continue;
|
||||
@ -254,7 +254,7 @@ wakeupshlk(struct lock *lk, const char *file, int line)
|
||||
if ((x & LK_ALL_WAITERS) == 0) {
|
||||
MPASS((x & ~LK_EXCLUSIVE_SPINNERS) ==
|
||||
LK_SHARERS_LOCK(1));
|
||||
if (atomic_cmpset_ptr(&lk->lk_lock, x, LK_UNLOCKED))
|
||||
if (atomic_cmpset_rel_ptr(&lk->lk_lock, x, LK_UNLOCKED))
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
@ -280,7 +280,7 @@ wakeupshlk(struct lock *lk, const char *file, int line)
|
||||
queue = SQ_SHARED_QUEUE;
|
||||
}
|
||||
|
||||
if (!atomic_cmpset_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x,
|
||||
if (!atomic_cmpset_rel_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x,
|
||||
v)) {
|
||||
sleepq_release(&lk->lock_object);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user