From 9a2b1f26237f05a6fee4bf95ba1cd92f1b88be92 Mon Sep 17 00:00:00 2001 From: Dongsheng Yang Date: Mon, 15 Oct 2018 01:06:29 -0400 Subject: [PATCH] TokenBucketThrottle: use reference to m_blockers.front() and then update it 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 --- src/common/Throttle.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc index 877ace344f1d..059248f3e71f 100644 --- a/src/common/Throttle.cc +++ b/src/common/Throttle.cc @@ -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. -- 2.47.3