cgroup1_release_agent is a function that runs within a private ve workqueue. When executed, it runs an executable in a userspace by a call to call_usermodehelper_ve. There is conflict that when ve is getting shutdown and some of last cgroups get's deleted at the same time, the workqueue might still be running, but ve_stop_ns has already been called. ve_stop_ns will stop usermode helper threads, needed for call_usermodehelper_ve. Because of that a call to call_usermodehelper_ve will never return, causing a hang. To defeat that hang VZ7 code of call_usermodehelper_ve included the check that ve is still running before running the userspace executable. It also checked for ve->init_task->flags & PF_EXITING condition. But in VZ8 the whole usermodehelper infrastructure is much more different. Also VZ8 does not have ve->init_task in it's fields. That is why it seems more relevant right now to do ve->is_running check before the call to call_usermodehelper_ve.
Signed-off-by: Valeriy Vdovin <[email protected]> --- kernel/cgroup/cgroup-v1.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 993ac38b895f..2521d2727b42 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -937,6 +937,13 @@ void cgroup1_release_agent(struct work_struct *work) mutex_unlock(&cgroup_mutex); + down_write(&ve->op_sem); + if (!ve->is_running) { + up_write(&ve->op_sem); + mutex_lock(&cgroup_mutex); + goto continue_free; + } + err = call_usermodehelper_ve(ve, argv[0], argv, envp, UMH_WAIT_EXEC); -- 2.27.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
