From 77b0ff46770f004573f47bba4e9baa9299d259f1 Mon Sep 17 00:00:00 2001 From: Mingxin Liu Date: Fri, 7 Apr 2017 18:20:18 +0800 Subject: [PATCH] PGMonitor: fix wrongly report "pg stuck in inactive" Signed-off-by: Mingxin Liu --- src/mon/PGMap.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 8b4a1010ab265..6150f0d003ee9 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -539,6 +539,13 @@ void PGMap::stat_pg_update(const pg_t pgid, pg_stat_t& s, s.blocked_by == n.blocked_by; stat_pg_sub(pgid, s, sameosds); + + // if acting_primary has shift to an just restored osd, and pg yet to finish + // peering, many attributes in current stats remain stale. others seem don't + // mater much while faulty last_active will make "pg stuck in" check unhappy. + if (!(n.state & (PG_STATE_ACTIVE | PG_STATE_PEERED)) && + n.last_active < s.last_active) + n.last_active = s.last_active; s = n; stat_pg_add(pgid, n, sameosds); } -- 2.39.5