[v4,10/31] ns: Add user and pid ns_id on restore

Submitted by Kirill Tkhai on Feb. 22, 2017, 11:31 a.m.

Details

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

Commit Message

Kirill Tkhai Feb. 22, 2017, 11:31 a.m.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/include/namespaces.h |    1 +
 criu/pstree.c             |    8 ++++++++
 2 files changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
index 0a8002ea6..988c3c0b8 100644
--- a/criu/include/namespaces.h
+++ b/criu/include/namespaces.h
@@ -135,6 +135,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 7812c29d6..8a8b00e4f 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -480,6 +480,14 @@  static int read_pstree_ids(struct pstree_item *pi)
 		if (rst_add_ns_id(pi->ids->net_ns_id, pi, &net_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;
+	}
 
 	return 0;
 }