]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: drop GIL around set_uri, set_health_checks
authorJohn Spray <john.spray@redhat.com>
Tue, 17 Oct 2017 22:16:22 +0000 (18:16 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 1 Nov 2017 23:03:29 +0000 (23:03 +0000)
These didn't need to keep the GIL to go and do their
pure C++ parts, and by keeping it they could deadlock
while trying to take ActiveMgrModules::lock.

Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 27ee148e040ebaf512f8e11f814b3a7c8cf21f8b)

src/mgr/BaseMgrModule.cc

index 95e75492c932f6f40ea3827e85828f65c3a5ed93..74d1a948f306e7bc23417b26e4b7ef8f7cb3c87a 100644 (file)
@@ -305,8 +305,10 @@ ceph_set_health_checks(BaseMgrModule *self, PyObject *args)
   jf.flush(*_dout);
   *_dout << dendl;
 
+  PyThreadState *tstate = PyEval_SaveThread();
   self->py_modules->set_health_checks(self->this_module->get_name(),
                                       std::move(out_checks));
+  PyEval_RestoreThread(tstate);
   
   Py_RETURN_NONE;
 }
@@ -493,7 +495,9 @@ ceph_set_uri(BaseMgrModule *self, PyObject *args)
   // We call down into PyModules even though we have a MgrPyModule
   // reference here, because MgrPyModule's fields are protected
   // by PyModules' lock.
+  PyThreadState *tstate = PyEval_SaveThread();
   self->py_modules->set_uri(self->this_module->get_name(), svc_str);
+  PyEval_RestoreThread(tstate);
 
   Py_RETURN_NONE;
 }