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

Submitted by Kirill Tkhai on Feb. 3, 2017, 4:13 p.m.

Details

Message ID 148613842143.3612.12866590644335109671.stgit@localhost.localdomain
State New
Series "Nested user namespaces support"
Headers show

Commit Message

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

Patch hide | download patch | download mbox

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;
 }