ve: fix container stopped state check

Submitted by Stanislav Kinsburskiy on Dec. 1, 2017, 11:22 a.m.

Details

Message ID 20171201112242.8573.67779.stgit@localhost.localdomain
State New
Series "ve: fix container stopped state check"
Headers show

Commit Message

Stanislav Kinsburskiy Dec. 1, 2017, 11:22 a.m.
Checking for empty cgroup is not correct, because init process leaves cgroup
early in do_exit.
This leads to a situation, when container is treated as stopped but its
resources (VEIP for instance) are not yet released.
Which in turn leads to container restart failure due to non-releases VEIP
address.

https://jira.sw.ru/browse/PSBM-78078

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 kernel/ve/ve.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index b0188c3..c628516 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -846,7 +846,7 @@  static int ve_state_read(struct cgroup *cg, struct cftype *cft,
 
 	if (ve->is_running)
 		seq_puts(m, "RUNNING");
-	else if (!nr_threads_ve(ve))
+	else if (!ve->init_task)
 		seq_puts(m, "STOPPED");
 	else if (ve->ve_ns)
 		seq_puts(m, "STOPPING");

Comments

Konstantin Khorenko Dec. 7, 2017, 12:07 p.m.
Please consider this to ReadyKernel.

https://readykernel.com/

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 12/01/2017 02:22 PM, Stanislav Kinsburskiy wrote:
> Checking for empty cgroup is not correct, because init process leaves cgroup
> early in do_exit.
> This leads to a situation, when container is treated as stopped but its
> resources (VEIP for instance) are not yet released.
> Which in turn leads to container restart failure due to non-releases VEIP
> address.
>
> https://jira.sw.ru/browse/PSBM-78078
>
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
> ---
>  kernel/ve/ve.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
> index b0188c3..c628516 100644
> --- a/kernel/ve/ve.c
> +++ b/kernel/ve/ve.c
> @@ -846,7 +846,7 @@ static int ve_state_read(struct cgroup *cg, struct cftype *cft,
>
>  	if (ve->is_running)
>  		seq_puts(m, "RUNNING");
> -	else if (!nr_threads_ve(ve))
> +	else if (!ve->init_task)
>  		seq_puts(m, "STOPPED");
>  	else if (ve->ve_ns)
>  		seq_puts(m, "STOPPING");
>
> _______________________________________________
> Devel mailing list
> Devel@openvz.org
> https://lists.openvz.org/mailman/listinfo/devel
> .
>