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.
Fixes: http://tracker.ceph.com/issues/39040
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
(cherry picked from commit
96b7319cc92e13198e05398921404959005c26d9)
Conflicts:
- there are new ceph_store_{set,get} commands
(and many other mgr changes) in Nautilus and later
Command set_cmd;
{
- PyThreadState *tstate = PyEval_SaveThread();
Mutex::Locker l(lock);
- PyEval_RestoreThread(tstate);
if (val) {
config_cache[global_key] = *val;
} else {
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;
}