Use acquire write to cr_lock to complement with release write at end

of locked region.

Submitted by:	kib
This commit is contained in:
glebius 2016-12-09 19:07:31 +00:00
parent b0a8bb2436
commit 40efd8a66e

View File

@ -144,7 +144,7 @@ counter_ratecheck(struct counter_rate *cr, int64_t limit)
* First try unlocked read, and then proceed with atomic.
*/
if ((cr->cr_lock == 0) &&
atomic_cmpset_int(&cr->cr_lock, 0, 1)) {
atomic_cmpset_acq_int(&cr->cr_lock, 0, 1)) {
/*
* Check if other thread has just went through the
* reset sequence before us.