mirror of
https://github.com/ceph/ceph
synced 2025-04-11 04:02:04 +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),
|
: module_config(module_config_), daemon_state(ds), cluster_state(cs),
|
||||||
monc(mc), clog(clog_), audit_clog(audit_clog_), objecter(objecter_),
|
monc(mc), clog(clog_), audit_clog(audit_clog_), objecter(objecter_),
|
||||||
client(client_), finisher(f),
|
client(client_), finisher(f),
|
||||||
|
cmd_finisher(g_ceph_context, "cmd_finisher", "cmdfin"),
|
||||||
server(server), py_module_registry(pmr), lock("ActivePyModules")
|
server(server), py_module_registry(pmr), lock("ActivePyModules")
|
||||||
{
|
{
|
||||||
store_cache = std::move(store_data);
|
store_cache = std::move(store_data);
|
||||||
|
cmd_finisher.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivePyModules::~ActivePyModules() = default;
|
ActivePyModules::~ActivePyModules() = default;
|
||||||
@ -434,6 +436,9 @@ void ActivePyModules::shutdown()
|
|||||||
lock.Lock();
|
lock.Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd_finisher.wait_for_empty();
|
||||||
|
cmd_finisher.stop();
|
||||||
|
|
||||||
modules.clear();
|
modules.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,9 @@ class ActivePyModules
|
|||||||
Objecter &objecter;
|
Objecter &objecter;
|
||||||
Client &client;
|
Client &client;
|
||||||
Finisher &finisher;
|
Finisher &finisher;
|
||||||
|
public:
|
||||||
|
Finisher cmd_finisher;
|
||||||
|
private:
|
||||||
DaemonServer &server;
|
DaemonServer &server;
|
||||||
PyModuleRegistry &py_module_registry;
|
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){
|
auto c = new FunctionContext([command_c, self](int command_r){
|
||||||
self->py_modules->get_objecter().wait_for_latest_osdmap(
|
self->py_modules->get_objecter().wait_for_latest_osdmap(
|
||||||
new FunctionContext([command_c, command_r](int wait_r){
|
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->outbl,
|
||||||
&command_c->outs,
|
&command_c->outs,
|
||||||
c);
|
new C_OnFinisher(c, &self->py_modules->cmd_finisher));
|
||||||
} else if (std::string(type) == "osd") {
|
} else if (std::string(type) == "osd") {
|
||||||
std::string err;
|
std::string err;
|
||||||
uint64_t osd_id = strict_strtoll(name, 10, &err);
|
uint64_t osd_id = strict_strtoll(name, 10, &err);
|
||||||
@ -186,7 +186,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
|
|||||||
&tid,
|
&tid,
|
||||||
&command_c->outbl,
|
&command_c->outbl,
|
||||||
&command_c->outs,
|
&command_c->outs,
|
||||||
command_c);
|
new C_OnFinisher(command_c, &self->py_modules->cmd_finisher));
|
||||||
} else if (std::string(type) == "mds") {
|
} else if (std::string(type) == "mds") {
|
||||||
int r = self->py_modules->get_client().mds_command(
|
int r = self->py_modules->get_client().mds_command(
|
||||||
name,
|
name,
|
||||||
@ -194,7 +194,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
|
|||||||
{},
|
{},
|
||||||
&command_c->outbl,
|
&command_c->outbl,
|
||||||
&command_c->outs,
|
&command_c->outs,
|
||||||
command_c);
|
new C_OnFinisher(command_c, &self->py_modules->cmd_finisher));
|
||||||
if (r != 0) {
|
if (r != 0) {
|
||||||
string msg("failed to send command to mds: ");
|
string msg("failed to send command to mds: ");
|
||||||
msg.append(cpp_strerror(r));
|
msg.append(cpp_strerror(r));
|
||||||
@ -221,7 +221,7 @@ ceph_send_command(BaseMgrModule *self, PyObject *args)
|
|||||||
&tid,
|
&tid,
|
||||||
&command_c->outbl,
|
&command_c->outbl,
|
||||||
&command_c->outs,
|
&command_c->outs,
|
||||||
command_c);
|
new C_OnFinisher(command_c, &self->py_modules->cmd_finisher));
|
||||||
PyEval_RestoreThread(tstate);
|
PyEval_RestoreThread(tstate);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user