]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/osd/PeeringState.cc: update last_unstale properly
authorKamoltat <ksirivad@redhat.com>
Tue, 21 Nov 2023 18:55:29 +0000 (18:55 +0000)
committerShraddha Agrawal <shraddha.agrawal000@gmail.com>
Thu, 24 Apr 2025 14:11:18 +0000 (19:41 +0530)
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 <ksirivad@redhat.com>
src/osd/PeeringState.cc

index 30fb2bf38cbbea4849412afee2c786092beb08c1..de2d275ed87a0d79d89b4ed1a03650226e7ba0a7 100644 (file)
@@ -4240,7 +4240,8 @@ std::optional<pg_stat_t> 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)