]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr: race between daemon state and service map in 'service status'
authorMykola Golub <mgolub@suse.com>
Thu, 1 Nov 2018 12:05:23 +0000 (14:05 +0200)
committerMykola Golub <mgolub@suse.com>
Thu, 1 Nov 2018 12:05:23 +0000 (14:05 +0200)
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>
src/mgr/DaemonServer.cc

index 99ed41d7b0c4a72c57aead9222fa15cdc37f188c..abe92d5af43e6d74ac531b1a95fbb0ec08fe3b48 100644 (file)
@@ -900,11 +900,7 @@ bool DaemonServer::_handle_command(
       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());