From: Mykola Golub Date: Mon, 30 Aug 2021 06:58:04 +0000 (+0100) Subject: osd: re-cache peer_bytes on every peering state activate X-Git-Tag: v16.2.7~82^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2a0451af54173d92c8292686c370ea1b06a4730a;p=ceph.git osd: re-cache peer_bytes on every peering state activate peer_bytes is used for backfill reservation request and may be reset if backfill is interrupted, and we want it set back before continuing backfill and re-sending the reservation request. Fixes: https://tracker.ceph.com/issues/52448 Signed-off-by: Mykola Golub (cherry picked from commit bdfdf96d2f6c3cf7e5595ae5b8238fd4c0b3c6bc) --- diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 355ba78ed6c..ac951a4a9f3 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -2802,6 +2802,9 @@ void PeeringState::activate( bool needs_past_intervals = pi.dne(); + // Save num_bytes for backfill reservation request, can't be negative + peer_bytes[peer] = std::max(0, pi.stats.stats.sum.num_bytes); + if (pi.last_update == info.last_update) { // empty log if (!pi.last_backfill.is_max()) @@ -2852,8 +2855,6 @@ void PeeringState::activate( pi.last_interval_started = info.last_interval_started; pi.history = info.history; pi.hit_set = info.hit_set; - // Save num_bytes for reservation request, can't be negative - peer_bytes[peer] = std::max(0, pi.stats.stats.sum.num_bytes); pi.stats.stats.clear(); pi.stats.stats.sum.num_bytes = peer_bytes[peer];