[CRIU] [PATCH] restore: --restore-detached implies CLONE_PARENT

Andrew Vagin avagin at parallels.com
Thu Aug 14 02:20:00 PDT 2014


Hi Tycho,

Jenkins reports that after this patch the zombie00 test starts failing.

[root at avagin-fc19-cr criu]# bash test/zdtm.sh static/zombie00
================================= CRIU CHECK =================================
Looks good.
Execute zdtm/live/static/zombie00
./zombie00 --pidfile=zombie00.pid --outfile=zombie00.out
Dump 2207
Restore
Test: zdtm/live/static/zombie00, Result: FAIL
==================================== ERROR ====================================
Test: zdtm/live/static/zombie00, Namespace: 
Dump log   : /root/git/orig/criu/test/dump/static/zombie00/2207/1/dump.log
--------------------------------- grep Error ---------------------------------
------------------------------------- END -------------------------------------
Restore log: /root/git/orig/criu/test/dump/static/zombie00/2207/1/restore.log
--------------------------------- grep Error ---------------------------------
(00.001371) Error (image.c:217): Unable to open ids-2208.img: No such file or directory
(00.001417) Error (image.c:217): Unable to open ids-2209.img: No such file or directory
(00.001456) Error (image.c:217): Unable to open ids-2210.img: No such file or directory
(00.001494) Error (image.c:217): Unable to open ids-2211.img: No such file or directory
(00.026826) Error (cr-restore.c:1085): 2207 killed by signal 17
(00.026985) Error (cr-restore.c:1706): Restoring FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================


On Wed, Aug 13, 2014 at 12:23:49PM -0500, Tycho Andersen wrote:
> We need to use CLONE_PARENT to prevent processes from immediately dying due to
> pdeath_sig when they are restored in detached mode.
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
>  cr-restore.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/cr-restore.c b/cr-restore.c
> index 2bc98e8..b24fa9e 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -1592,15 +1592,19 @@ static int restore_root_task(struct pstree_item *init)
>  	 * In that case create the root task as the child one to+
>  	 * the caller. This is the only way to correctly restore the
>  	 * pdeath_sig of the root task. But also looks nice.
> +	 *
> +	 * Alternatively, if we are --restore-detached, a similar trick is
> +	 * needed to correctly restore pdeath_sig and prevent processes from
> +	 * dying once restored.
>  	 */
> -	if (opts.swrk_restore)
> +	if (opts.swrk_restore || opts.restore_detach)
>  		init->rst->clone_flags |= CLONE_PARENT;
>  
>  	ret = fork_with_pid(init);
>  	if (ret < 0)
>  		return -1;
>  
> -	if (opts.swrk_restore) {
> +	if (opts.swrk_restore || opts.restore_detach) {
>  		if (ptrace(PTRACE_SEIZE, init->pid.real, 0, 0)) {
>  			pr_perror("Can't attach to init");
>  			goto out;
> -- 
> 1.9.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list