]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/BaseMgrModule: drop GIL in set_config
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 30 Mar 2019 03:15:49 +0000 (11:15 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 1 Apr 2019 01:11:44 +0000 (09:11 +0800)
Holding GIL and run mon_command turns out to be easily deadlock-prone.
https://tracker.ceph.com/issues/35985 is a typical report, and here is
another.

Fix by using PyModuleConfig's own lock for protection of concurrent
accesses, which should be sufficient enough.

Fixes: http://tracker.ceph.com/issues/39040
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mgr/BaseMgrModule.cc

index 899a8917e60054c0e7c9712f854d88e576e48c2f..87eda069d50250ccacbed810b04d977f3f381bef 100644 (file)
@@ -443,7 +443,9 @@ ceph_set_module_option(BaseMgrModule *self, PyObject *args)
   if (value) {
     val = value;
   }
+  PyThreadState *tstate = PyEval_SaveThread();
   self->py_modules->set_config(module, key, val);
+  PyEval_RestoreThread(tstate);
 
   Py_RETURN_NONE;
 }