[CRIU] [PATCH v2 08/36] ns: Set hookups for all namespaces

Kirill Tkhai ktkhai at virtuozzo.com
Fri Feb 3 08:12:49 PST 2017


Discover relationships between namespaces
and populate appropriate fields in ns_id

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/namespaces.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/criu/namespaces.c b/criu/namespaces.c
index 12a5408e2..de5ced1f2 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -889,6 +889,22 @@ int collect_user_namespaces(bool for_dump)
 	return walk_namespaces(&user_ns_desc, collect_user_ns, NULL);
 }
 
+static int collect_ns_hierarhy(bool for_dump)
+{
+	struct ns_id *ns;
+
+	if (!for_dump)
+		return 0;
+
+	for (ns = ns_ids; ns != NULL; ns = ns->next) {
+		if (ns->type == NS_CRIU)
+			continue;
+		if (set_ns_hookups(ns) < 0)
+			return -1;
+	}
+	return 0;
+}
+
 static int check_user_ns(int pid)
 {
 	int status;
@@ -1567,6 +1583,10 @@ int collect_namespaces(bool for_dump)
 {
 	int ret;
 
+	ret = collect_ns_hierarhy(for_dump);
+	if (ret < 0)
+		return ret;
+
 	ret = collect_user_namespaces(for_dump);
 	if (ret < 0)
 		return ret;



More information about the CRIU mailing list