2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

restore: Set up zombie name on restore

Otherwise we lost 1:1 mapping between names being
dumped and what user sees after restore.

| 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>

https://bugzilla.openvz.org/show_bug.cgi?id=2635

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov
2013-07-12 18:12:12 +04:00
committed by Pavel Emelyanov
parent f38fe4480c
commit a18f28d61e
2 changed files with 7 additions and 2 deletions

View File

@@ -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;

View File

@@ -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);