From 3ee6f97b3ed172be98dd429a4aef54de5fb689f7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 29 Jun 2021 18:49:52 -0400 Subject: [PATCH] mgr/ActivePyModules: don't take unnecessary lock This isn't needed. Signed-off-by: Sage Weil --- src/mgr/ActivePyModules.cc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 58e51e30ad5..a5589062e99 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -426,22 +426,20 @@ PyObject *ActivePyModules::get_python(const std::string &what) return f.get(); }); } else if (what == "mgr_ips") { - return cluster_state.with_mgrmap([&](const MgrMap &mgr_map) { - with_gil_t with_gil{no_gil}; - f.open_array_section("ips"); - std::set did; - for (auto& i : server.get_myaddrs().v) { - std::string ip = i.ip_only_to_str(); - if (did.count(ip)) { - continue; - } - did.insert(ip); - f.dump_string("ip", ip); + entity_addrvec_t myaddrs = server.get_myaddrs(); + with_gil_t with_gil{no_gil}; + f.open_array_section("ips"); + std::set did; + for (auto& i : myaddrs.v) { + std::string ip = i.ip_only_to_str(); + if (did.count(ip)) { + continue; } - f.close_section(); - return f.get(); - }); - + did.insert(ip); + f.dump_string("ip", ip); + } + f.close_section(); + return f.get(); } else if (what == "have_local_config_map") { with_gil_t with_gil{no_gil}; f.dump_bool("have_local_config_map", have_local_config_map); -- 2.39.5