fixes: 915a1130c7ee4ffb6de3f69a5bd98c5ee42a723f Signed-off-by: Valeriy Vdovin <valeriy.vdo...@virtuozzo.com> Reviewed-by: Kirill Tkhai <ktk...@virtuozzo.com>
Cherry-picked from 5dceccf5dd794673ebb1b0e6840d96aa654ec33e) Signed-off-by: Valeriy Vdovin <valeriy.vdo...@virtuozzo.com> --- include/linux/cgroup.h | 1 + kernel/cgroup/cgroup.c | 24 ++++++++++++++++++++++++ kernel/ve/ve.c | 3 +++ 3 files changed, 28 insertions(+) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 4f0dd51338bf..c0a42c3d43fa 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -867,6 +867,7 @@ int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen, #ifdef CONFIG_VE extern void cgroup_mark_ve_root(struct ve_struct *ve); +void cgroup_unmark_ve_roots(struct ve_struct *ve); #endif #else /* !CONFIG_CGROUPS */ diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 0335a07f64e6..4488df184235 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1908,6 +1908,30 @@ void cgroup_mark_ve_root(struct ve_struct *ve) spin_unlock_irq(&css_set_lock); } +void cgroup_unmark_ve_roots(struct ve_struct *ve) +{ + struct cgrp_cset_link *link; + struct css_set *cset; + struct cgroup *cgrp; + + spin_lock_irq(&css_set_lock); + + rcu_read_lock(); + cset = rcu_dereference(ve->ve_ns)->cgroup_ns->root_cset; + if (WARN_ON(!cset)) + goto unlock; + + list_for_each_entry(link, &cset->cgrp_links, cgrp_link) { + cgrp = link->cgrp; + clear_bit(CGRP_VE_ROOT, &cgrp->flags); + } + link_ve_root_cpu_cgroup(cset->subsys[cpu_cgrp_id]); +unlock: + rcu_read_unlock(); + + spin_unlock_irq(&css_set_lock); +} + struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp) { struct cgroup *ve_root = NULL; diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index b83b2b66a875..f7d605357d2e 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -520,6 +520,9 @@ void ve_exit_ns(struct pid_namespace *pid_ns) */ if (!ve_ns || ve_ns->pid_ns_for_children != pid_ns) goto unlock; + + cgroup_unmark_ve_roots(ve); + /* * At this point all userspace tasks in container are dead. */ -- 2.27.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel