]> git.apps.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)
committerPrashant D <pdhange@redhat.com>
Fri, 17 May 2019 00:26:17 +0000 (20:26 -0400)
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>
(cherry picked from commit 96b7319cc92e13198e05398921404959005c26d9)

Conflicts:
src/mgr/BaseMgrModule.cc : Resolved in ceph_config_set

src/mgr/BaseMgrModule.cc

index 1dbc5bfb480888bcdf2ee117e25e1e98c2e38c1b..499c355260e1b5ad421e0365531a759b937d9d5b 100644 (file)
@@ -406,7 +406,9 @@ ceph_config_set(BaseMgrModule *self, PyObject *args)
   if (value) {
     val = value;
   }
+  PyThreadState *tstate = PyEval_SaveThread();
   self->py_modules->set_config(self->this_module->get_name(), key, val);
+  PyEval_RestoreThread(tstate);
 
   Py_RETURN_NONE;
 }