]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: race between daemon state and service map in 'service status' 25369/head
authorMykola Golub <mgolub@suse.com>
Thu, 1 Nov 2018 12:05:23 +0000 (14:05 +0200)
committerPrashant D <pdhange@redhat.com>
Mon, 3 Dec 2018 02:52:35 +0000 (21:52 -0500)
If a daemon is removed from daemon_state it is still present in the
service map. So when 'service status' iterates daemons from service map,
it may not find it in daemon_state. Use pending_service_map instead
when building daemons lists, which is up ot date with daemon_state.

Fixes: http://tracker.ceph.com/issues/36656
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit 9f53d1bab374f23f23bb355b7d77aa5fd6351aeb)

src/mgr/DaemonServer.cc

index 63d8b90d81f827f7aa71eaff637aa0f8d4a689e2..87c399b802b44c6ba10f84a996e9a9d12cc2420c 100644 (file)
@@ -773,11 +773,7 @@ bool DaemonServer::handle_command(MCommand *m)
       f.reset(Formatter::create("json-pretty"));
     // only include state from services that are in the persisted service map
     f->open_object_section("service_status");
-    ServiceMap s;
-    cluster_state.with_servicemap([&](const ServiceMap& service_map) {
-       s = service_map;
-      });
-    for (auto& p : s.services) {
+    for (auto& p : pending_service_map.services) {
       f->open_object_section(p.first.c_str());
       for (auto& q : p.second.daemons) {
        f->open_object_section(q.first.c_str());