[lxc-devel] [RFC][PATCH][lxc]: unfreeze while stopping

Michel Normand normand at fr.ibm.com
Wed Jun 9 08:14:16 UTC 2010


Le mardi 08 juin 2010 à 19:07 -0700, Sukadev Bhattiprolu a écrit :
> I am not too sure, but if user wants to stop a container is there a
> reason not to implicitly unfreeze the container and stop ?
> 
> ---
> From: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
> Date: Tue, 8 Jun 2010 18:42:00 -0700
> Subject: [PATCH 1/1]: unfreeze while stopping container
> 
> When a container is being stopped, it must also be unfrozen after posting
> the SIGKILL. Otherwise if the container is frozen when the SIGKILL is posted,
> the SIGKILL will remain pending and the lxc-stop command will block until
> lxc-unfreeze is explicitly called).

For me the lxc-start/lxc-stop and
lxc-freeze/lxc-unfreeze are two sets of commands
that should not be mixed.

If the container was previously frozen by a lxc-freeze
then the user has to issue a lxc-unfreeze before to issue the lxc-stop.

-- 
Michel

> 
> (lxc-stop waits for the container to exit and close the socket but since
> the container is frozen, lxc-stop will block).
> 
> [Dan Smith pointed this out while testing out-of-tree lxc-checkpoint/restart]
> 
> Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
> ---
>  src/lxc/stop.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lxc/stop.c b/src/lxc/stop.c
> index b751af5..f441e46 100644
> --- a/src/lxc/stop.c
> +++ b/src/lxc/stop.c
> @@ -83,8 +83,14 @@ extern int lxc_stop_callback(int fd, struct lxc_request *request,
>  	int ret;
>  
>  	answer.ret = kill(handler->pid, SIGKILL);
> -	if (!answer.ret)
> -		return 0;
> +	if (!answer.ret) {
> +		ret = lxc_unfreeze(handler->name);
> +		if (!ret)
> +			return 0;
> +
> +		ERROR("failed to unfreeze container");
> +		answer.ret = ret;
> +	}
>  
>  	ret = send(fd, &answer, sizeof(answer), 0);
>  	if (ret < 0) {







More information about the lxc-devel mailing list