mirror of
https://github.com/ceph/ceph
synced 2025-04-01 23:02:17 +00:00
Merge PR #27619 into master
* refs/pull/27619/head: mgr/BaseMgrModule: run MonCommandCompletion on the finisher mgr/BaseMgrModule: fix leak Reviewed-by: Mykola Golub <mgolub@suse.com> Reviewed-by: Tim Serong <tserong@suse.com>
This commit is contained in:
commit
df9d1b92a9
@ -46,9 +46,11 @@ ActivePyModules::ActivePyModules(PyModuleConfig &module_config_,
|
||||
: module_config(module_config_), daemon_state(ds), cluster_state(cs),
|
||||
monc(mc), clog(clog_), audit_clog(audit_clog_), objecter(objecter_),
|
||||
client(client_), finisher(f),
|
||||
cmd_finisher(g_ceph_context, "cmd_finisher", "cmdfin"),
|
||||
server(server), py_module_registry(pmr), lock("ActivePyModules")
|
||||
{
|
||||
store_cache = std::move(store_data);
|
||||
cmd_finisher.start();
|
||||
}
|
||||
|
||||
ActivePyModules::~ActivePyModules() = default;
|
||||
@ -434,6 +436,9 @@ void ActivePyModules::shutdown()
|
||||
lock.Lock();
|
||||
}
|
||||
|
||||
cmd_finisher.wait_for_empty();
|
||||
cmd_finisher.stop();
|
||||
|
||||
modules.clear();
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,9 @@ class ActivePyModules
|
||||
Objecter &objecter;
|
||||
Client &client;
|
||||
Finisher &finisher;
|
||||
public:
|
||||
Finisher cmd_finisher;
|
||||
private:
|
||||
DaemonServer &server;
|
||||
PyModuleRegistry &py_module_registry;
|
||||
|
||||
|
@ -154,7 +154,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
|
||||
auto c = new FunctionContext([command_c, self](int command_r){
|
||||
self->py_modules->get_objecter().wait_for_latest_osdmap(
|
||||
new FunctionContext([command_c, command_r](int wait_r){
|
||||
command_c->finish(command_r);
|
||||
command_c->complete(command_r);
|
||||
})
|
||||
);
|
||||
});
|
||||
@ -165,7 +165,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
|
||||
{},
|
||||
&command_c->outbl,
|
||||
&command_c->outs,
|
||||
c);
|
||||
new C_OnFinisher(c, &self->py_modules->cmd_finisher));
|
||||
} else if (std::string(type) == "osd") {
|
||||
std::string err;
|
||||
uint64_t osd_id = strict_strtoll(name, 10, &err);
|
||||
@ -186,7 +186,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
|
||||
&tid,
|
||||
&command_c->outbl,
|
||||
&command_c->outs,
|
||||
command_c);
|
||||
new C_OnFinisher(command_c, &self->py_modules->cmd_finisher));
|
||||
} else if (std::string(type) == "mds") {
|
||||
int r = self->py_modules->get_client().mds_command(
|
||||
name,
|
||||
@ -194,7 +194,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
|
||||
{},
|
||||
&command_c->outbl,
|
||||
&command_c->outs,
|
||||
command_c);
|
||||
new C_OnFinisher(command_c, &self->py_modules->cmd_finisher));
|
||||
if (r != 0) {
|
||||
string msg("failed to send command to mds: ");
|
||||
msg.append(cpp_strerror(r));
|
||||
@ -221,7 +221,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
|
||||
&tid,
|
||||
&command_c->outbl,
|
||||
&command_c->outs,
|
||||
command_c);
|
||||
new C_OnFinisher(command_c, &self->py_modules->cmd_finisher));
|
||||
PyEval_RestoreThread(tstate);
|
||||
return nullptr;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user