cgroups: close dfd_mon but keep dfd_con and dfd_lim open for all cgroup hierarchies

parent d70122bc
......@@ -1362,7 +1362,7 @@ __cgfsng_ops static bool cgfsng_chown(struct cgroup_ops *ops,
return true;
}
__cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops)
__cgfsng_ops static void cgfsng_finalize(struct cgroup_ops *ops)
{
if (!ops)
return;
......@@ -1370,6 +1370,15 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops)
if (!ops->hierarchies)
return;
for (int i = 0; ops->hierarchies[i]; i++) {
struct hierarchy *h = ops->hierarchies[i];
/* Close all monitor cgroup file descriptors. */
close_prot_errno_disarm(h->dfd_mon);
}
/* Close the cgroup root file descriptor. */
close_prot_errno_disarm(ops->dfd_mnt);
/*
* The checking for freezer support should obviously be done at cgroup
* initialization time but that doesn't work reliable. The freezer
......@@ -3311,7 +3320,7 @@ struct cgroup_ops *cgroup_ops_init(struct lxc_conf *conf)
cgfsng_ops->payload_delegate_controllers = cgfsng_payload_delegate_controllers;
cgfsng_ops->payload_create = cgfsng_payload_create;
cgfsng_ops->payload_enter = cgfsng_payload_enter;
cgfsng_ops->payload_finalize = cgfsng_payload_finalize;
cgfsng_ops->finalize = cgfsng_finalize;
cgfsng_ops->get_cgroup = cgfsng_get_cgroup;
cgfsng_ops->get = cgfsng_get;
cgfsng_ops->set = cgfsng_set;
......
......@@ -218,7 +218,7 @@ struct cgroup_ops {
struct lxc_handler *handler);
bool (*monitor_delegate_controllers)(struct cgroup_ops *ops);
bool (*payload_delegate_controllers)(struct cgroup_ops *ops);
void (*payload_finalize)(struct cgroup_ops *ops);
void (*finalize)(struct cgroup_ops *ops);
const char *(*get_limiting_cgroup)(struct cgroup_ops *ops, const char *controller);
};
......
......@@ -1827,7 +1827,7 @@ static int lxc_spawn(struct lxc_handler *handler)
}
}
cgroup_ops->payload_finalize(cgroup_ops);
cgroup_ops->finalize(cgroup_ops);
TRACE("Finished setting up cgroups");
/* Run any host-side start hooks */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment