[v3,12/33] ns: Add user and pid ns_id on restore

Submitted by Kirill Tkhai on Feb. 16, 2017, 12:08 p.m.

Details

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

Commit Message

Kirill Tkhai Feb. 16, 2017, 12:08 p.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 e92785e1b..4e609b7ab 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;
 }