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

Cyrill Gorcunov gorcunov at openvz.org
Fri Jul 12 05:59:18 EDT 2013


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 at openvz.org>
Acked-by: Andrew Vagin <avagin at parallels.com>
---
 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