]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: don't update osd stat which is already out 38353/head
authorZhi Zhang <willzzhang@tencent.com>
Wed, 29 Jul 2020 10:47:42 +0000 (18:47 +0800)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 1 Dec 2020 00:11:41 +0000 (03:11 +0300)
Ceph status still reports slow requests on the OSD which is already out.
When orignal PG monitor handled PGSTATS msg, it wouldn't update osd stat
if this OSD is not in OSD map, but current MGR had no checks on that.

Fixes: https://tracker.ceph.com/issues/46440
Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
(cherry picked from commit 493ec9d3acd3f57eed3e4b96ad7c6739c2089ff1)

src/mgr/ClusterState.cc

index fc7d42cb073cf08b9f9c2da6373a43bb3ab74334..28340d56dddc962010a45bbedf628ac5def96e7e 100644 (file)
@@ -72,7 +72,17 @@ void ClusterState::ingest_pgstats(ref_t<MPGStats> stats)
   std::lock_guard l(lock);
 
   const int from = stats->get_orig_source().num();
-  pending_inc.update_stat(from, std::move(stats->osd_stat));
+  bool is_in = with_osdmap([from](const OSDMap& osdmap) {
+    return osdmap.is_in(from);
+  });
+
+  if (is_in) {
+    pending_inc.update_stat(from, std::move(stats->osd_stat));
+  } else {
+    osd_stat_t empty_stat;
+    empty_stat.seq = stats->osd_stat.seq;
+    pending_inc.update_stat(from, std::move(empty_stat));  
+  }
 
   for (auto p : stats->pg_stat) {
     pg_t pgid = p.first;