[CRIU] [PATCH v2 14/36] ns: Add user, net and pid ns_id on restore

Kirill Tkhai ktkhai at virtuozzo.com
Fri Feb 3 08:13:41 PST 2017


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/include/namespaces.h |    1 +
 criu/pstree.c             |   12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
index e613756f2..4fb6cadcb 100644
--- a/criu/include/namespaces.h
+++ b/criu/include/namespaces.h
@@ -133,6 +133,7 @@ extern unsigned int child_userns_xid(unsigned int xid, UidGidExtent **map, int n
 
 extern struct ns_desc pid_ns_desc;
 extern struct ns_desc user_ns_desc;
+extern struct ns_desc net_ns_desc;
 extern unsigned long root_ns_mask;
 
 extern const struct fdtype_ops nsfile_dump_ops;
diff --git a/criu/pstree.c b/criu/pstree.c
index 833b3d0ee..1ba762b80 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -473,6 +473,18 @@ static int read_pstree_ids(struct pstree_item *pi)
 		if (rst_add_ns_id(pi->ids->mnt_ns_id, pi, &mnt_ns_desc))
 			return -1;
 	}
+	if (pi->ids->has_user_ns_id) {
+		if (rst_add_ns_id(pi->ids->user_ns_id, pi, &user_ns_desc))
+			return -1;
+	}
+	if (pi->ids->has_pid_ns_id) {
+		if (rst_add_ns_id(pi->ids->pid_ns_id, pi, &pid_ns_desc))
+			return -1;
+	}
+	if (pi->ids->has_net_ns_id) {
+		if (rst_add_ns_id(pi->ids->net_ns_id, pi, &net_ns_desc))
+			return -1;
+	}
 
 	return 0;
 }



More information about the CRIU mailing list