[CRIU] [PATCH v4 04/31] ns: Set hookups for all namespaces

Kirill Tkhai ktkhai at virtuozzo.com
Wed Feb 22 03:31:01 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 dd9fb7680..340c2fa73 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -900,6 +900,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;
@@ -1581,6 +1597,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