]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: drop GIL in get_config 26613/head
authorJohn Spray <john.spray@redhat.com>
Wed, 14 Nov 2018 11:19:14 +0000 (06:19 -0500)
committerBrad Hubbard <bhubbard@redhat.com>
Thu, 28 Feb 2019 22:32:05 +0000 (08:32 +1000)
Fixes: https://tracker.ceph.com/issues/35985
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit d590a53)

Conflicts:
        src/mgr/ActivePyModules.cc

src/mgr/ActivePyModules.cc
src/mgr/BaseMgrModule.cc

index ea7128c53996fc4d0c89e61489b729571be89759..20f35c9c086fce5b75f4c4ee4b83b6fe6e222e36 100644 (file)
@@ -420,15 +420,13 @@ void ActivePyModules::notify_all(const LogEntry &log_entry)
 bool ActivePyModules::get_config(const std::string &module_name,
     const std::string &key, std::string *val) const
 {
-  PyThreadState *tstate = PyEval_SaveThread();
-  Mutex::Locker l(lock);
-  PyEval_RestoreThread(tstate);
-
   const std::string global_key = PyModuleRegistry::config_prefix
     + module_name + "/" + key;
 
   dout(4) << __func__ << "key: " << global_key << dendl;
 
+  Mutex::Locker l(lock);
+
   if (config_cache.count(global_key)) {
     *val = config_cache.at(global_key);
     return true;
index 6777a5238881cc2580d6a7cb6f138af59e508725..cc9904d0adb569982292d4accf15f6464d011d0c 100644 (file)
@@ -356,9 +356,13 @@ ceph_config_get(BaseMgrModule *self, PyObject *args)
     return nullptr;
   }
 
+  PyThreadState *tstate = PyEval_SaveThread();
   std::string value;
   bool found = self->py_modules->get_config(self->this_module->get_name(),
       what, &value);
+
+  PyEval_RestoreThread(tstate);
+
   if (found) {
     dout(10) << "ceph_config_get " << what << " found: " << value.c_str() << dendl;
     return PyString_FromString(value.c_str());