]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
TokenBucketThrottle: use reference to m_blockers.front() and then update it 24604/head
authorDongsheng Yang <dongsheng.yang@easystack.cn>
Mon, 15 Oct 2018 05:06:29 +0000 (01:06 -0400)
committerDongsheng Yang <dongsheng.yang@easystack.cn>
Wed, 17 Oct 2018 01:00:46 +0000 (21:00 -0400)
As we need to update the blocker below, then we need to use reference to front object,
rather than a new object of blocker.

Fixes: http://tracker.ceph.com/issues/36475
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
src/common/Throttle.cc

index 877ace344f1d9b37d8fda1e0b0427941d3d616fd..059248f3e71f45781f9717cb159b00472105fef4 100644 (file)
@@ -741,7 +741,7 @@ void TokenBucketThrottle::add_tokens() {
     // check the m_blockers from head to tail, if blocker can get
     // enough tokens, let it go.
     while (!m_blockers.empty()) {
-      Blocker blocker = m_blockers.front();
+      Blocker &blocker = m_blockers.front();
       uint64_t got = m_throttle.get(blocker.tokens_requested);
       if (got == blocker.tokens_requested) {
        // got enough tokens for front.