From: Kamoltat Date: Tue, 21 Nov 2023 18:55:29 +0000 (+0000) Subject: src/osd/PeeringState.cc: update last_unstale properly X-Git-Tag: v20.3.0~10^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5485e0028522f4720a737c27682cae4bcb0fa09a;p=ceph.git src/osd/PeeringState.cc: update last_unstale properly Problem: When we update the `pg_stat` we don't check whether the pg state is in `stale`. Therefore, the attribute `last_unstale` will always get updated even if the pg state actually contains `stale`. Solution: Place a condition to only update the attribute `last_unstale` when we the pg truly doesn't have `stale` in its state. Fixes: https://tracker.ceph.com/issues/67777 Signed-off-by: Kamoltat --- diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 30fb2bf38cb..de2d275ed87 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -4240,7 +4240,8 @@ std::optional PeeringState::prepare_stats_for_publish( info.stats.last_active = now; if (info.stats.state & (PG_STATE_ACTIVE|PG_STATE_PEERED)) info.stats.last_peered = now; - info.stats.last_unstale = now; + if ((info.stats.state & PG_STATE_STALE) == 0) + info.stats.last_unstale = now; if ((info.stats.state & PG_STATE_DEGRADED) == 0) info.stats.last_undegraded = now; if ((info.stats.state & PG_STATE_UNDERSIZED) == 0)