mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-02 17:37:17 +00:00
re-open cgmanager socket after fork in daemonized start
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
1d16785799
commit
7eb44573b0
@ -114,7 +114,8 @@ static bool cgm_dbus_connect(void)
|
||||
|
||||
static void cgm_dbus_disconnect(void)
|
||||
{
|
||||
nih_free(cgroup_manager);
|
||||
if (cgroup_manager)
|
||||
nih_free(cgroup_manager);
|
||||
cgroup_manager = NULL;
|
||||
}
|
||||
|
||||
@ -886,5 +887,6 @@ static struct cgroup_ops cgmanager_ops = {
|
||||
.attach = cgm_attach,
|
||||
.mount_cgroup = cgm_mount_cgroup,
|
||||
.nrtasks = cgm_get_nrtasks,
|
||||
.disconnect = cgm_dbus_disconnect,
|
||||
};
|
||||
#endif
|
||||
|
@ -167,3 +167,11 @@ int lxc_cgroup_get(const char *filename, char *value, size_t len, const char *na
|
||||
return ops->get(filename, value, len, name, lxcpath);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void restart_cgroups(void)
|
||||
{
|
||||
if (ops && ops->disconnect)
|
||||
ops->disconnect();
|
||||
ops = NULL;
|
||||
cgroup_ops_init();
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ struct cgroup_ops {
|
||||
bool (*attach)(const char *name, const char *lxcpath, pid_t pid);
|
||||
bool (*mount_cgroup)(void *hdata, const char *root, int type);
|
||||
int (*nrtasks)(void *hdata);
|
||||
void (*disconnect)(void);
|
||||
};
|
||||
|
||||
extern bool cgroup_attach(const char *name, const char *lxcpath, pid_t pid);
|
||||
@ -64,5 +65,6 @@ extern bool cgroup_create_legacy(struct lxc_handler *handler);
|
||||
extern int cgroup_nrtasks(struct lxc_handler *handler);
|
||||
extern const char *cgroup_get_cgroup(struct lxc_handler *handler, const char *subsystem);
|
||||
extern bool cgroup_unfreeze(struct lxc_handler *handler);
|
||||
extern void restart_cgroups(void);
|
||||
|
||||
#endif
|
||||
|
@ -637,6 +637,7 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
|
||||
open("/dev/null", O_RDWR);
|
||||
open("/dev/null", O_RDWR);
|
||||
setsid();
|
||||
restart_cgroups();
|
||||
} else {
|
||||
if (!am_single_threaded()) {
|
||||
ERROR("Cannot start non-daemonized container when threaded");
|
||||
|
Loading…
Reference in New Issue
Block a user