]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common/Throttle: return new count in put() right away 38814/head
authorKefu Chai <kchai@redhat.com>
Fri, 8 Jan 2021 07:55:49 +0000 (15:55 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 8 Jan 2021 08:01:48 +0000 (16:01 +0800)
commitfedaa12737d4c347b00275f3f4d323e58b4c6689
tree1808816028f4895462dd966de3641d1a1f0c93ed
parent0aba110696b956581f7777147da27db589343f33
common/Throttle: return new count in put() right away

before this change, the is a racing after updating `count`, where
`count` could be updated again by another thread using this Throttle
instance. but the caller expects the value before the second mutation.

actually, the only caller which care about the return value is the
unittests in test/common/Throttle.cc. and without this change, the
ThrottleTest.get test fails randomly. almost 1 out of 5 runs fails.

after this change, the test passes after running for 256 times without
failures.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/Throttle.cc