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

of locked region.

Submitted by:	kib
This commit is contained in:
Gleb Smirnoff 2016-12-09 19:07:31 +00:00
parent 90458813cd
commit 5040da77c1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309751

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.