diff options
author | Kefu Chai <kchai@redhat.com> | 2019-07-07 05:14:49 +0200 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2019-08-03 03:34:50 +0200 |
commit | c93dc8849145c1630058e4c0e527f404929216ff (patch) | |
tree | ba5aa6d6ae388bae28c30708d412172fded965b5 /src | |
parent | librados: s/Mutex/ceph::mutex/ (diff) | |
download | ceph-c93dc8849145c1630058e4c0e527f404929216ff.tar.xz ceph-c93dc8849145c1630058e4c0e527f404929216ff.zip |
mgr: s/Mutex/ceph::mutex/
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mgr/ActivePyModule.h | 1 | ||||
-rw-r--r-- | src/mgr/ActivePyModules.cc | 20 | ||||
-rw-r--r-- | src/mgr/ActivePyModules.h | 4 | ||||
-rw-r--r-- | src/mgr/ClusterState.cc | 1 | ||||
-rw-r--r-- | src/mgr/ClusterState.h | 4 | ||||
-rw-r--r-- | src/mgr/DaemonServer.cc | 5 | ||||
-rw-r--r-- | src/mgr/DaemonServer.h | 4 | ||||
-rw-r--r-- | src/mgr/DaemonState.cc | 2 | ||||
-rw-r--r-- | src/mgr/Mgr.cc | 45 | ||||
-rw-r--r-- | src/mgr/Mgr.h | 6 | ||||
-rw-r--r-- | src/mgr/MgrClient.cc | 30 | ||||
-rw-r--r-- | src/mgr/MgrClient.h | 7 | ||||
-rw-r--r-- | src/mgr/MgrStandby.cc | 7 | ||||
-rw-r--r-- | src/mgr/MgrStandby.h | 2 | ||||
-rw-r--r-- | src/mgr/OSDPerfMetricCollector.cc | 2 | ||||
-rw-r--r-- | src/mgr/OSDPerfMetricCollector.h | 4 | ||||
-rw-r--r-- | src/mgr/PyModule.h | 6 | ||||
-rw-r--r-- | src/mgr/PyModuleRegistry.h | 2 | ||||
-rw-r--r-- | src/mgr/StandbyPyModules.cc | 8 | ||||
-rw-r--r-- | src/mgr/StandbyPyModules.h | 6 |
20 files changed, 79 insertions, 87 deletions
diff --git a/src/mgr/ActivePyModule.h b/src/mgr/ActivePyModule.h index c3780269ee0..beafa629982 100644 --- a/src/mgr/ActivePyModule.h +++ b/src/mgr/ActivePyModule.h @@ -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" diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 2676d6c5ae9..40250a549a5 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -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); } diff --git a/src/mgr/ActivePyModules.h b/src/mgr/ActivePyModules.h index b3feb0be4e6..f36d6593c63 100644 --- a/src/mgr/ActivePyModules.h +++ b/src/mgr/ActivePyModules.h @@ -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, diff --git a/src/mgr/ClusterState.cc b/src/mgr/ClusterState.cc index a74fa4feb14..d616141caf5 100644 --- a/src/mgr/ClusterState.cc +++ b/src/mgr/ClusterState.cc @@ -28,7 +28,6 @@ ClusterState::ClusterState( const MgrMap& mgrmap) : monc(monc_), objecter(objecter_), - lock("ClusterState"), mgr_map(mgrmap) {} diff --git a/src/mgr/ClusterState.h b/src/mgr/ClusterState.h index 4d43cddbe89..897eaa7aed5 100644 --- a/src/mgr/ClusterState.h +++ b/src/mgr/ClusterState.h @@ -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; diff --git a/src/mgr/DaemonServer.cc b/src/mgr/DaemonServer.cc index 1145e27ca1b..ed200f232eb 100644 --- a/src/mgr/DaemonServer.cc +++ b/src/mgr/DaemonServer.cc @@ -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"); diff --git a/src/mgr/DaemonServer.h b/src/mgr/DaemonServer.h index 5c87dec15e7..14ed023f06b 100644 --- a/src/mgr/DaemonServer.h +++ b/src/mgr/DaemonServer.h @@ -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> ¶m_str_map); diff --git a/src/mgr/DaemonState.cc b/src/mgr/DaemonState.cc index e0cc9f2e0b9..10e526f8d56 100644 --- a/src/mgr/DaemonState.cc +++ b/src/mgr/DaemonState.cc @@ -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()); diff --git a/src/mgr/Mgr.cc b/src/mgr/Mgr.cc index 0ee9dff4064..46179fde085 100644 --- a/src/mgr/Mgr.cc +++ b/src/mgr/Mgr.cc @@ -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(); } } diff --git a/src/mgr/Mgr.h b/src/mgr/Mgr.h index 252d946bbc2..85b1137fe0f 100644 --- a/src/mgr/Mgr.h +++ b/src/mgr/Mgr.h @@ -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; diff --git a/src/mgr/MgrClient.cc b/src/mgr/MgrClient.cc index 49c66c6aeb3..603ca0e9d2f 100644 --- a/src/mgr/MgrClient.cc +++ b/src/mgr/MgrClient.cc @@ -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; diff --git a/src/mgr/MgrClient.h b/src/mgr/MgrClient.h index 9c73ba9d26f..6649148f094 100644 --- a/src/mgr/MgrClient.h +++ b/src/mgr/MgrClient.h @@ -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; diff --git a/src/mgr/MgrStandby.cc b/src/mgr/MgrStandby.cc index a40d02b1712..527dc042a74 100644 --- a/src/mgr/MgrStandby.cc +++ b/src/mgr/MgrStandby.cc @@ -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 diff --git a/src/mgr/MgrStandby.h b/src/mgr/MgrStandby.h index ae1d02e3328..98b9d0d22a7 100644 --- a/src/mgr/MgrStandby.h +++ b/src/mgr/MgrStandby.h @@ -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; diff --git a/src/mgr/OSDPerfMetricCollector.cc b/src/mgr/OSDPerfMetricCollector.cc index 5cd8e27326a..e57ee9aa544 100644 --- a/src/mgr/OSDPerfMetricCollector.cc +++ b/src/mgr/OSDPerfMetricCollector.cc @@ -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> diff --git a/src/mgr/OSDPerfMetricCollector.h b/src/mgr/OSDPerfMetricCollector.h index 89e33091574..266278972b1 100644 --- a/src/mgr/OSDPerfMetricCollector.h +++ b/src/mgr/OSDPerfMetricCollector.h @@ -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; diff --git a/src/mgr/PyModule.h b/src/mgr/PyModule.h index 412fa38f088..2f980bdf509 100644 --- a/src/mgr/PyModule.h +++ b/src/mgr/PyModule.h @@ -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(); diff --git a/src/mgr/PyModuleRegistry.h b/src/mgr/PyModuleRegistry.h index 52e9907e361..94b591fe275 100644 --- a/src/mgr/PyModuleRegistry.h +++ b/src/mgr/PyModuleRegistry.h @@ -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; diff --git a/src/mgr/StandbyPyModules.cc b/src/mgr/StandbyPyModules.cc index 988107190b3..5735b415e60 100644 --- a/src/mgr/StandbyPyModules.cc +++ b/src/mgr/StandbyPyModules.cc @@ -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(); diff --git a/src/mgr/StandbyPyModules.h b/src/mgr/StandbyPyModules.h index 0de0b07eb61..d8d5e1a07ef 100644 --- a/src/mgr/StandbyPyModules.h +++ b/src/mgr/StandbyPyModules.h @@ -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; |