Skip to content

Commit

Permalink
Merge pull request ceph#49487 from trociny/wip-58269
Browse files Browse the repository at this point in the history
mgr: don't dump global config holding gil

Reviewed-by: Tim Serong <[email protected]>
  • Loading branch information
yuriw authored Feb 20, 2023
2 parents 7d26207 + 133a46e commit f69b76e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/mgr/ActivePyModules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,16 @@ PyObject *ActivePyModules::get_python(const std::string &what)
}
f.close_section();
} else if (what.substr(0, 6) == "config") {
// We make a copy of the global config to avoid printing
// to py formater (which may drop-take GIL) while holding
// the global config lock, which might deadlock with other
// thread that is holding the GIL and acquiring the global
// config lock.
ConfigProxy config{g_conf()};
if (what == "config_options") {
g_conf().config_options(&f);
config.config_options(&f);
} else if (what == "config") {
g_conf().show_config(&f);
config.show_config(&f);
}
} else if (what == "mon_map") {
without_gil_t no_gil;
Expand Down Expand Up @@ -512,8 +518,6 @@ PyObject *ActivePyModules::get_python(const std::string &what)
derr << "Python module requested unknown data '" << what << "'" << dendl;
Py_RETURN_NONE;
}
without_gil_t no_gil;
no_gil.acquire_gil();
if(ttl_seconds) {
return jf.get();
} else {
Expand Down

0 comments on commit f69b76e

Please sign in to comment.