[CRIU] [PATCH v2 16/21] ns: Fixup pid_for_children_ns of threads

Kirill Tkhai ktkhai at virtuozzo.com
Wed May 31 10:54:23 PDT 2017


Populate pid ns (always) and pid_for_children ns
(if it's empty, i.e., in old dumps).

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cr-restore.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 56e48ab42..cac963dce 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -805,10 +805,23 @@ static int open_cores(int pid, CoreEntry *leader_core)
 	for (i = 0; i < current->nr_threads; i++) {
 		tpid = vtid(current, i);
 
-		if (tpid == pid)
+		if (tpid == pid) {
 			cores[i] = leader_core;
-		else if (open_core(tpid, &cores[i]))
+			continue;
+		}
+
+		if (open_core(tpid, &cores[i]))
 			goto err;
+		if (cores[i]->ids) {
+			/* We don't dump pid_ns_id of threads as it's same to group leader's */
+			cores[i]->ids->has_pid_ns_id = true;
+			cores[i]->ids->pid_ns_id = current->ids->pid_ns_id;
+			if (fixup_pid_for_children_ns(cores[i]->ids)) {
+				core_entry__free_unpacked(cores[i], NULL);
+				goto err;
+			}
+		} else
+			cores[i]->ids = current->ids;
 	}
 
 	current->core = cores;



More information about the CRIU mailing list