[CRIU] [PATCH] restore: Set up zombie name on restore, v2

Andrew Vagin avagin at parallels.com
Fri Jul 12 05:53:02 EDT 2013


On Fri, Jul 12, 2013 at 01:30:41PM +0400, Cyrill Gorcunov wrote:
> On Fri, Jul 12, 2013 at 01:19:47PM +0400, Cyrill Gorcunov wrote:
> > 
> > Crap. Thanks for the catch.
> 
> Andrew, could you please give this one a shot?

Looks good.

Acked-by: Andrew Vagin <avagin at parallels.com>

And I recomend to fix a commit message, because the current one contains
a process tree w/o zombies

 1455 pts/0    T      0:00          \_ ./crtools restore -t 1448
 1448 ?        Ss     0:00          |   \_ ./zombie00 --pidfile=zombie00.pid --outfile=zombie00.out
 1449 ?        Z      0:00          |       \_ [zombie00] <defunct>
 1450 ?        Z      0:00          |       \_ [zombie00] <defunct>
 1451 ?        Z      0:00          |       \_ [zombie00] <defunct>
 1452 ?        Z      0:00          |       \_ [zombie00] <defunct>

> From 7129e629a1ce187dbda6ef146d75c3b0880b8f6d Mon Sep 17 00:00:00 2001
> From: Cyrill Gorcunov <gorcunov at openvz.org>
> Date: Fri, 12 Jul 2013 10:02:16 +0400
> Subject: [PATCH] restore: Set up zombie name on restore
> 
> | 5230 \_ /home/criu/criu restore --file-locks --tcp-established -x -D dump/zombie00/5211/1 -o restore.log -v4 -d
> | 5211    \_ ./zombie00 --pidfile=zombie00.pid --outfile=zombie00.out
> 
> https://bugzilla.openvz.org/show_bug.cgi?id=2635
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  cr-dump.c    | 1 +
>  cr-restore.c | 8 ++++++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/cr-dump.c b/cr-dump.c
> index ceee96f..863bffd 100644
> --- a/cr-dump.c
> +++ b/cr-dump.c
> @@ -1122,6 +1122,7 @@ static int dump_one_zombie(const struct pstree_item *item,
>  	if (!core)
>  		return -1;
>  
> +	strncpy((char *)core->tc->comm, pps->comm, TASK_COMM_LEN);
>  	core->tc->task_state = TASK_DEAD;
>  	core->tc->exit_code = pps->exit_code;
>  
> diff --git a/cr-restore.c b/cr-restore.c
> index 20e6f41..e9eac8d 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -722,10 +722,14 @@ static int restore_one_fake(void)
>  	return 0;
>  }
>  
> -static int restore_one_zombie(int pid, int exit_code)
> +static int restore_one_zombie(int pid, CoreEntry *core)
>  {
> +	int exit_code = core->tc->exit_code;
> +
>  	pr_info("Restoring zombie with %d code\n", exit_code);
>  
> +	sys_prctl(PR_SET_NAME, (long)(void *)core->tc->comm, 0, 0, 0);
> +
>  	if (task_entries != NULL) {
>  		restore_finish_stage(CR_STATE_RESTORE);
>  		zombie_prepare_signals();
> @@ -799,7 +803,7 @@ static int restore_one_task(int pid, CoreEntry *core)
>  		ret = restore_one_alive_task(pid, core);
>  		break;
>  	case TASK_DEAD:
> -		ret = restore_one_zombie(pid, core->tc->exit_code);
> +		ret = restore_one_zombie(pid, core);
>  		break;
>  	default:
>  		pr_err("Unknown state in code %d\n", (int)core->tc->task_state);
> -- 
> 1.8.1.4
> 



More information about the CRIU mailing list