]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr: s/Mutex/ceph::mutex/
authorKefu Chai <kchai@redhat.com>
Sun, 7 Jul 2019 03:14:49 +0000 (11:14 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 3 Aug 2019 01:34:50 +0000 (09:34 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
20 files changed:
src/mgr/ActivePyModule.h
src/mgr/ActivePyModules.cc
src/mgr/ActivePyModules.h
src/mgr/ClusterState.cc
src/mgr/ClusterState.h
src/mgr/DaemonServer.cc
src/mgr/DaemonServer.h
src/mgr/DaemonState.cc
src/mgr/Mgr.cc
src/mgr/Mgr.h
src/mgr/MgrClient.cc
src/mgr/MgrClient.h
src/mgr/MgrStandby.cc
src/mgr/MgrStandby.h
src/mgr/OSDPerfMetricCollector.cc
src/mgr/OSDPerfMetricCollector.h
src/mgr/PyModule.h
src/mgr/PyModuleRegistry.h
src/mgr/StandbyPyModules.cc
src/mgr/StandbyPyModules.h

index c3780269ee047bc6d1f0f0ff4f15a164dde82e4e..beafa629982bc07aa23b2a6b19d6ee45adea2097 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "common/cmdparse.h"
 #include "common/LogEntry.h"
-#include "common/Mutex.h"
 #include "common/Thread.h"
 #include "mon/health_check.h"
 #include "mgr/Gil.h"
index 2676d6c5ae9192dfe2124d05aadd2437dbe4e777..40250a549a5f693794eaffea29aafe84772b701a 100644 (file)
@@ -47,7 +47,7 @@ ActivePyModules::ActivePyModules(PyModuleConfig &module_config_,
     monc(mc), clog(clog_), audit_clog(audit_clog_), objecter(objecter_),
     client(client_), finisher(f),
     cmd_finisher(g_ceph_context, "cmd_finisher", "cmdfin"),
-    server(server), py_module_registry(pmr), lock("ActivePyModules")
+    server(server), py_module_registry(pmr)
 {
   store_cache = std::move(store_data);
   cmd_finisher.start();
@@ -434,21 +434,21 @@ void ActivePyModules::shutdown()
     auto module = i.second.get();
     const auto& name = i.first;
 
-    lock.Unlock();
+    lock.unlock();
     dout(10) << "calling module " << name << " shutdown()" << dendl;
     module->shutdown();
     dout(10) << "module " << name << " shutdown() returned" << dendl;
-    lock.Lock();
+    lock.lock();
   }
 
   // For modules implementing serve(), finish the threads where we
   // were running that.
   for (auto &i : modules) {
-    lock.Unlock();
+    lock.unlock();
     dout(10) << "joining module " << i.first << dendl;
     i.second->thread.join();
     dout(10) << "joined module " << i.first << dendl;
-    lock.Lock();
+    lock.lock();
   }
 
   cmd_finisher.wait_for_empty();
@@ -895,12 +895,12 @@ void ActivePyModules::set_health_checks(const std::string& module_name,
 {
   bool changed = false;
 
-  lock.Lock();
+  lock.lock();
   auto p = modules.find(module_name);
   if (p != modules.end()) {
     changed = p->second->set_health_checks(std::move(checks));
   }
-  lock.Unlock();
+  lock.unlock();
 
   // immediately schedule a report to be sent to the monitors with the new
   // health checks that have changed. This is done asynchronusly to avoid
@@ -925,15 +925,15 @@ int ActivePyModules::handle_command(
   std::stringstream *ds,
   std::stringstream *ss)
 {
-  lock.Lock();
+  lock.lock();
   auto mod_iter = modules.find(module_name);
   if (mod_iter == modules.end()) {
     *ss << "Module '" << module_name << "' is not available";
-    lock.Unlock();
+    lock.unlock();
     return -ENOENT;
   }
 
-  lock.Unlock();
+  lock.unlock();
   return mod_iter->second->handle_command(cmdmap, inbuf, ds, ss);
 }
 
index b3feb0be4e64cc155a9b9e713eb68adcd6c02a8e..f36d6593c63bc430255089342f9eb7bbe96d3465 100644 (file)
@@ -16,7 +16,7 @@
 #include "ActivePyModule.h"
 
 #include "common/Finisher.h"
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 
 #include "PyFormatter.h"
 
@@ -55,7 +55,7 @@ private:
 
   map<std::string,ProgressEvent> progress_events;
 
-  mutable Mutex lock{"ActivePyModules::lock"};
+  mutable ceph::mutex lock = ceph::make_mutex("ActivePyModules::lock");
 
 public:
   ActivePyModules(PyModuleConfig &module_config,
index a74fa4feb14155fb926e171cc38e6aacc7657a9e..d616141caf55e726b151f23ae3cb85b433fa609b 100644 (file)
@@ -28,7 +28,6 @@ ClusterState::ClusterState(
   const MgrMap& mgrmap)
   : monc(monc_),
     objecter(objecter_),
-    lock("ClusterState"),
     mgr_map(mgrmap)
 {}
 
index 4d43cddbe896f4909b0c49747f9ec9199c3cc411..897eaa7aed5e6fcee1bed04b3be64a65e256969b 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "mds/FSMap.h"
 #include "mon/MgrMap.h"
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 
 #include "osdc/Objecter.h"
 #include "mon/MonClient.h"
@@ -39,7 +39,7 @@ protected:
   Objecter *objecter;
   FSMap fsmap;
   ServiceMap servicemap;
-  mutable Mutex lock;
+  mutable ceph::mutex lock = ceph::make_mutex("ClusterState");
 
   MgrMap mgr_map;
 
index 1145e27ca1bdc7072c59eb4eb39e330e48c6da1b..ed200f232ebf58d489e55f8ebf76c32870fef20e 100644 (file)
@@ -76,7 +76,6 @@ DaemonServer::DaemonServer(MonClient *monc_,
       py_modules(py_modules_),
       clog(clog_),
       audit_clog(audit_clog_),
-      lock("DaemonServer"),
       pgmap_ready(false),
       timer(g_ceph_context, lock),
       shutting_down(false),
@@ -308,7 +307,7 @@ void DaemonServer::tick()
 // fire after all modules have had a chance to set their health checks.
 void DaemonServer::schedule_tick_locked(double delay_sec)
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   if (tick_event) {
     timer.cancel_event(tick_event);
@@ -2755,7 +2754,7 @@ void DaemonServer::handle_conf_change(const ConfigProxy& conf,
 
 void DaemonServer::_send_configure(ConnectionRef c)
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   auto configure = make_message<MMgrConfigure>();
   configure->stats_period = g_conf().get_val<int64_t>("mgr_stats_period");
index 5c87dec15e73decfc61eb3636052f9bf27425038..14ed023f06b97ed42c4f275501bfd5359ba40c8e 100644 (file)
@@ -19,7 +19,7 @@
 #include <set>
 #include <string>
 
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 #include "common/LogClient.h"
 #include "common/Timer.h"
 
@@ -76,7 +76,7 @@ protected:
 
   epoch_t pending_service_map_dirty = 0;
 
-  Mutex lock;
+  ceph::mutex lock = ceph::make_mutex("DaemonServer");
 
   static void _generate_command_map(cmdmap_t& cmdmap,
                                     map<string,string> &param_str_map);
index e0cc9f2e0b9a2b694800705ced0c8cca6fb29787..10e526f8d562dd3bdd78c8c35609c0614a80a51e 100644 (file)
@@ -156,7 +156,7 @@ void DaemonStateIndex::_insert(DaemonStatePtr dm)
 
 void DaemonStateIndex::_erase(const DaemonKey& dmk)
 {
-  ceph_assert(lock.is_wlocked());
+  ceph_assert(ceph_mutex_is_wlocked(lock));
 
   const auto to_erase = all.find(dmk);
   ceph_assert(to_erase != all.end());
index 0ee9dff40648d09910915286a05f53c12bd49722..46179fde08573da1e29301f69c7d5263a16dff86 100644 (file)
@@ -46,7 +46,6 @@ Mgr::Mgr(MonClient *monc_, const MgrMap& mgrmap,
   objecter(objecter_),
   client(client_),
   client_messenger(clientm_),
-  lock("Mgr::lock"),
   finisher(g_ceph_context, "Mgr", "mgr-fin"),
   digest_received(false),
   py_module_registry(py_module_registry_),
@@ -167,14 +166,14 @@ void Mgr::background_init(Context *completion)
 
 std::map<std::string, std::string> Mgr::load_store()
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   dout(10) << "listing keys" << dendl;
   JSONCommand cmd;
   cmd.run(monc, "{\"prefix\": \"config-key ls\"}");
-  lock.Unlock();
+  lock.unlock();
   cmd.wait();
-  lock.Lock();
+  lock.lock();
   ceph_assert(cmd.r == 0);
 
   std::map<std::string, std::string> loaded;
@@ -194,9 +193,9 @@ std::map<std::string, std::string> Mgr::load_store()
       std::ostringstream cmd_json;
       cmd_json << "{\"prefix\": \"config-key get\", \"key\": \"" << key << "\"}";
       get_cmd.run(monc, cmd_json.str());
-      lock.Unlock();
+      lock.unlock();
       get_cmd.wait();
-      lock.Lock();
+      lock.lock();
       if (get_cmd.r == 0) { // tolerate racing config-key change
        if (key.substr(0, device_prefix.size()) == device_prefix) {
          // device/
@@ -227,7 +226,7 @@ std::map<std::string, std::string> Mgr::load_store()
 
 void Mgr::init()
 {
-  std::lock_guard l(lock);
+  std::unique_lock l(lock);
   ceph_assert(initializing);
   ceph_assert(!initialized);
 
@@ -263,9 +262,9 @@ void Mgr::init()
   monc->reopen_session();
 
   // Start Objecter and wait for OSD map
-  lock.Unlock();  // Drop lock because OSDMap dispatch calls into my ms_dispatch
+  lock.unlock();  // Drop lock because OSDMap dispatch calls into my ms_dispatch
   objecter->wait_for_osd_map();
-  lock.Lock();
+  lock.lock();
 
   // Populate PGs in ClusterState
   cluster_state.with_osdmap_and_pgmap([this](const OSDMap &osd_map,
@@ -275,26 +274,22 @@ void Mgr::init()
 
   // Wait for FSMap
   dout(4) << "waiting for FSMap..." << dendl;
-  while (!cluster_state.have_fsmap()) {
-    fs_map_cond.Wait(lock);
-  }
+  fs_map_cond.wait(l, [this] { return cluster_state.have_fsmap();});
 
   dout(4) << "waiting for config-keys..." << dendl;
 
   // Wait for MgrDigest...
   dout(4) << "waiting for MgrDigest..." << dendl;
-  while (!digest_received) {
-    digest_cond.Wait(lock);
-  }
+  digest_cond.wait(l, [this] { return digest_received; });
 
   // Load module KV store
   auto kv_store = load_store();
 
   // Migrate config from KV store on luminous->mimic
   // drop lock because we do blocking config sets to mon
-  lock.Unlock();
+  lock.unlock();
   py_module_registry->upgrade_config(monc, kv_store);
-  lock.Lock();
+  lock.lock();
 
   // assume finisher already initialized in background_init
   dout(4) << "starting python modules..." << dendl;
@@ -309,7 +304,7 @@ void Mgr::init()
 
 void Mgr::load_all_metadata()
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   JSONCommand mds_cmd;
   mds_cmd.run(monc, "{\"prefix\": \"mds metadata\"}");
@@ -318,11 +313,11 @@ void Mgr::load_all_metadata()
   JSONCommand mon_cmd;
   mon_cmd.run(monc, "{\"prefix\": \"mon metadata\"}");
 
-  lock.Unlock();
+  lock.unlock();
   mds_cmd.wait();
   osd_cmd.wait();
   mon_cmd.wait();
-  lock.Lock();
+  lock.lock();
 
   ceph_assert(mds_cmd.r == 0);
   ceph_assert(mon_cmd.r == 0);
@@ -422,7 +417,7 @@ void Mgr::shutdown()
 
 void Mgr::handle_osd_map()
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   std::set<std::string> names_exist;
 
@@ -508,7 +503,7 @@ void Mgr::handle_service_map(ref_t<MServiceMap> m)
 void Mgr::handle_mon_map()
 {
   dout(20) << __func__ << dendl;
-  assert(lock.is_locked_by_me());
+  assert(ceph_mutex_is_locked_by_me(lock));
   std::set<std::string> names_exist;
   cluster_state.with_monmap([&] (auto &monmap) {
     for (unsigned int i = 0; i < monmap.size(); i++) {
@@ -562,13 +557,13 @@ bool Mgr::ms_dispatch2(const ref_t<Message>& m)
 
 void Mgr::handle_fs_map(ref_t<MFSMap> m)
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   std::set<std::string> names_exist;
   
   const FSMap &new_fsmap = m->get_fsmap();
 
-  fs_map_cond.Signal();
+  fs_map_cond.notify_all();
 
   // TODO: callers (e.g. from python land) are potentially going to see
   // the new fsmap before we've bothered populating all the resulting
@@ -668,7 +663,7 @@ void Mgr::handle_mgr_digest(ref_t<MMgrDigest> m)
 
   if (!digest_received) {
     digest_received = true;
-    digest_cond.Signal();
+    digest_cond.notify_all();
   }
 }
 
index 252d946bbc2ae19a488c30de7d9f773766c8ee2a..85b1137fe0ff224bca12eb4c264c8e35b20a6659 100644 (file)
@@ -44,13 +44,13 @@ protected:
   Client    *client;
   Messenger *client_messenger;
 
-  mutable Mutex lock;
+  mutable ceph::mutex lock = ceph::make_mutex("Mgr::lock");
   Finisher finisher;
 
   // Track receipt of initial data during startup
-  Cond fs_map_cond;
+  ceph::condition_variable fs_map_cond;
   bool digest_received;
-  Cond digest_cond;
+  ceph::condition_variable digest_cond;
 
   PyModuleRegistry *py_module_registry;
   DaemonStateIndex daemon_state;
index 49c66c6aeb38fb2e1936abdfd78f051487ac5a1a..603ca0e9d2f36be58cc56f91c554211ec5e82759 100644 (file)
@@ -53,7 +53,7 @@ void MgrClient::init()
 
 void MgrClient::shutdown()
 {
-  std::lock_guard l(lock);
+  std::unique_lock l(lock);
   ldout(cct, 10) << dendl;
 
   if (connect_retry_callback) {
@@ -73,10 +73,9 @@ void MgrClient::shutdown()
     m->daemon_name = daemon_name;
     m->service_name = service_name;
     session->con->send_message2(m);
-    utime_t timeout;
-    timeout.set_from_double(cct->_conf.get_val<double>(
+    auto timeout = ceph::make_timespan(cct->_conf.get_val<double>(
                              "mgr_client_service_daemon_unregister_timeout"));
-    shutdown_cond.WaitInterval(lock, timeout);
+    shutdown_cond.wait_for(l, timeout);
   }
 
   timer.shutdown();
@@ -112,7 +111,7 @@ bool MgrClient::ms_dispatch2(const ref_t<Message>& m)
 
 void MgrClient::reconnect()
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   if (session) {
     ldout(cct, 4) << "Terminating session with "
@@ -131,10 +130,11 @@ void MgrClient::reconnect()
     return;
   }
 
-  if (last_connect_attempt != utime_t()) {
-    utime_t now = ceph_clock_now();
-    utime_t when = last_connect_attempt;
-    when += cct->_conf.get_val<double>("mgr_connect_retry_interval");
+  if (!clock_t::is_zero(last_connect_attempt)) {
+    auto now = clock_t::now();
+    auto when = last_connect_attempt +
+      ceph::make_timespan(
+        cct->_conf.get_val<double>("mgr_connect_retry_interval"));
     if (now < when) {
       if (!connect_retry_callback) {
        connect_retry_callback = timer.add_event_at(
@@ -156,7 +156,7 @@ void MgrClient::reconnect()
 
   ldout(cct, 4) << "Starting new session with " << map.get_active_addrs()
                << dendl;
-  last_connect_attempt = ceph_clock_now();
+  last_connect_attempt = clock_t::now();
 
   session.reset(new MgrSessionState());
   session->con = msgr->connect_to(CEPH_ENTITY_TYPE_MGR,
@@ -203,7 +203,7 @@ void MgrClient::_send_open()
 
 bool MgrClient::handle_mgr_map(ref_t<MMgrMap> m)
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   ldout(cct, 20) << *m << dendl;
 
@@ -253,7 +253,7 @@ void MgrClient::_send_stats()
 
 void MgrClient::_send_report()
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
   ceph_assert(session);
   report_callback = nullptr;
 
@@ -376,7 +376,7 @@ void MgrClient::_send_pgstats()
 
 bool MgrClient::handle_mgr_configure(ref_t<MMgrConfigure> m)
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   ldout(cct, 20) << *m << dendl;
 
@@ -408,7 +408,7 @@ bool MgrClient::handle_mgr_configure(ref_t<MMgrConfigure> m)
 bool MgrClient::handle_mgr_close(ref_t<MMgrClose> m)
 {
   service_daemon = false;
-  shutdown_cond.Signal();
+  shutdown_cond.notify_all();
   return true;
 }
 
@@ -444,7 +444,7 @@ int MgrClient::start_command(const vector<string>& cmd, const bufferlist& inbl,
 
 bool MgrClient::handle_command_reply(ref_t<MCommandReply> m)
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
 
   ldout(cct, 20) << *m << dendl;
 
index 9c73ba9d26f3a83415d42b79f71a7a843a25025a..6649148f094a5a868ed78e09787c6136e699e42e 100644 (file)
@@ -60,8 +60,8 @@ protected:
 
   std::unique_ptr<MgrSessionState> session;
 
-  Mutex lock = {"MgrClient::lock"};
-  Cond shutdown_cond;
+  ceph::mutex lock = ceph::make_mutex("MgrClient::lock");
+  ceph::condition_variable shutdown_cond;
 
   uint32_t stats_period = 0;
   uint32_t stats_threshold = 0;
@@ -69,7 +69,8 @@ protected:
 
   CommandTable<MgrCommand> command_table;
 
-  utime_t last_connect_attempt;
+  using clock_t = ceph::real_clock;
+  clock_t::time_point last_connect_attempt;
 
   uint64_t last_config_bl_version = 0;
 
index a40d02b171210c6a31404b0bfe8b7e8ef426e34c..527dc042a7436a02257d3bc545cfd265f85e2bf0 100644 (file)
@@ -52,7 +52,6 @@ MgrStandby::MgrStandby(int argc, const char **argv) :
   log_client(g_ceph_context, client_messenger.get(), &monc.monmap, LogClient::NO_FLAGS),
   clog(log_client.create_channel(CLOG_CHANNEL_CLUSTER)),
   audit_clog(log_client.create_channel(CLOG_CHANNEL_AUDIT)),
-  lock("MgrStandby::lock"),
   finisher(g_ceph_context, "MgrStandby", "mgrsb-fin"),
   timer(g_ceph_context, lock),
   py_module_registry(clog),
@@ -190,7 +189,7 @@ int MgrStandby::init()
 
 void MgrStandby::send_beacon()
 {
-  ceph_assert(lock.is_locked_by_me());
+  ceph_assert(ceph_mutex_is_locked_by_me(lock));
   dout(20) << state_str() << dendl;
 
   std::list<PyModuleRef> modules = py_module_registry.get_modules();
@@ -440,9 +439,9 @@ bool MgrStandby::ms_dispatch2(const ref_t<Message>& m)
   bool handled = false;
   if (active_mgr) {
     auto am = active_mgr;
-    lock.Unlock();
+    lock.unlock();
     handled = am->ms_dispatch2(m);
-    lock.Lock();
+    lock.lock();
   }
   if (m->get_type() == MSG_MGR_MAP) {
     // let this pass through for mgrc
index ae1d02e3328aeea7e0a11b3613f2775010cc9734..98b9d0d22a787e297359337f28182d0ac4a660ed 100644 (file)
@@ -49,7 +49,7 @@ protected:
   LogClient log_client;
   LogChannelRef clog, audit_clog;
 
-  Mutex lock;
+  ceph::mutex lock = ceph::make_mutex("MgrStandby::lock");
   Finisher finisher;
   SafeTimer timer;
 
index 5cd8e27326a851dad35739a418f9c94c667383ae..e57ee9aa544fdca6e9117475e10c00fa850c92a3 100644 (file)
@@ -26,7 +26,7 @@ bool is_limited(const std::map<OSDPerfMetricQueryID,
 } // anonymous namespace
 
 OSDPerfMetricCollector::OSDPerfMetricCollector(Listener &listener)
-  : listener(listener), lock("OSDPerfMetricCollector::lock") {
+  : listener(listener) {
 }
 
 std::map<OSDPerfMetricQuery, OSDPerfMetricLimits>
index 89e330915749f39497ba60180f953b42f5cbb297..266278972b15ab3e9de833a37af3857508b25d90 100644 (file)
@@ -4,7 +4,7 @@
 #ifndef OSD_PERF_METRIC_COLLECTOR_H_
 #define OSD_PERF_METRIC_COLLECTOR_H_
 
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 
 #include "mgr/OSDPerfMetricTypes.h"
 
@@ -46,7 +46,7 @@ private:
                    std::map<OSDPerfMetricKey, PerformanceCounters>> Counters;
 
   Listener &listener;
-  mutable Mutex lock;
+  mutable ceph::mutex lock = ceph::make_mutex("OSDPerfMetricCollector::lock");
   OSDPerfMetricQueryID next_query_id = 0;
   Queries queries;
   Counters counters;
index 412fa38f088abd9ed4837386c7031c97bfff2c88..2f980bdf50997d8fd974a877b3a574eaf0905c53 100644 (file)
@@ -18,7 +18,7 @@
 #include <string>
 #include <vector>
 #include <boost/optional.hpp>
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 #include "Python.h"
 #include "Gil.h"
 #include "mon/MgrMap.h"
@@ -46,7 +46,7 @@ public:
 
 class PyModule
 {
-  mutable Mutex lock{"PyModule::lock"};
+  mutable ceph::mutex lock = ceph::make_mutex("PyModule::lock");
 private:
   const std::string module_name;
   std::string get_site_packages();
@@ -171,7 +171,7 @@ typedef std::shared_ptr<PyModule> PyModuleRef;
 
 class PyModuleConfig {
 public:
-  mutable Mutex lock{"PyModuleConfig::lock"};
+  mutable ceph::mutex lock = ceph::make_mutex("PyModuleConfig::lock");
   std::map<std::string, std::string> config;
 
   PyModuleConfig();
index 52e9907e361b22d167dc0e67388d00eaa2649698..94b591fe275ecd9d47e2c81967ea9356d72dce50 100644 (file)
@@ -38,7 +38,7 @@
 class PyModuleRegistry
 {
 private:
-  mutable Mutex lock{"PyModuleRegistry::lock"};
+  mutable ceph::mutex lock = ceph::make_mutex("PyModuleRegistry::lock");
   LogChannelRef clog;
 
   std::map<std::string, PyModuleRef> modules;
index 988107190b373b36b23d6b79f969d91afc0fdd3b..5735b415e60cd4aa59fcba610991e52651298ffa 100644 (file)
@@ -56,20 +56,20 @@ void StandbyPyModules::shutdown()
     auto module = i.second.get();
     const auto& name = i.first;
     dout(10) << "waiting for module " << name << " to shutdown" << dendl;
-    lock.Unlock();
+    lock.unlock();
     module->shutdown();
-    lock.Lock();
+    lock.lock();
     dout(10) << "module " << name << " shutdown" << dendl;
   }
 
   // For modules implementing serve(), finish the threads where we
   // were running that.
   for (auto &i : modules) {
-    lock.Unlock();
+    lock.unlock();
     dout(10) << "joining thread for module " << i.first << dendl;
     i.second->thread.join();
     dout(10) << "joined thread for module " << i.first << dendl;
-    lock.Lock();
+    lock.lock();
   }
 
   modules.clear();
index 0de0b07eb61bb4663baeeb5219ccc1a6f0d8c7dc..d8d5e1a07ef615c5c9171c2f9fe7666813d93838 100644 (file)
@@ -19,7 +19,7 @@
 #include <map>
 
 #include "common/Thread.h"
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 
 #include "mgr/Gil.h"
 #include "mon/MonClient.h"
@@ -33,7 +33,7 @@ class Finisher;
  */
 class StandbyPyModuleState
 {
-  mutable Mutex lock{"StandbyPyModuleState::lock"};
+  mutable ceph::mutex lock = ceph::make_mutex("StandbyPyModuleState::lock");
 
   MgrMap mgr_map;
   PyModuleConfig &module_config;
@@ -100,7 +100,7 @@ class StandbyPyModule : public PyModuleRunner
 class StandbyPyModules
 {
 private:
-  mutable Mutex lock{"StandbyPyModules::lock"};
+  mutable ceph::mutex lock = ceph::make_mutex("StandbyPyModules::lock");
   std::map<std::string, std::unique_ptr<StandbyPyModule>> modules;
 
   StandbyPyModuleState state;