[CRIU] [PATCH] mnt: Add comment about mntns to tasks assignment

Pavel Emelyanov xemul at parallels.com
Tue Mar 31 00:59:18 PDT 2015


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---

diff --git a/mount.c b/mount.c
index 021c6e3..96f3718 100644
--- a/mount.c
+++ b/mount.c
@@ -2017,6 +2017,15 @@ int restore_task_mnt_ns(struct pstree_item *current)
 		unsigned int id = current->ids->mnt_ns_id;
 		struct ns_id *nsid;
 
+		/*
+		 * Regardless of the namespace a task wants to
+		 * live in, by that point they all will live in
+		 * root's one (see prepare_pstree_kobj_ids() +
+		 * get_clone_mask()). So if the current task's
+		 * target namespace is the root's one -- it's
+		 * already there, otherwise it will have to do
+		 * setns().
+		 */
 		if (root_item->ids->mnt_ns_id == id)
 			return 0;
 
diff --git a/pstree.c b/pstree.c
index 6f0f138..2dbcb04 100644
--- a/pstree.c
+++ b/pstree.c
@@ -689,7 +689,12 @@ set_mask:
 			 * Mount namespaces are setns()-ed at
 			 * restore_task_mnt_ns() explicitly,
 			 * no need in creating it with its own
-			 * temporary namespace
+			 * temporary namespace.
+			 *
+			 * Root task is exceptional -- it will
+			 * be born in a fresh new mount namespace
+			 * which will be populated with all other
+			 * namespaces' entries.
 			 */
 			rsti(item)->clone_flags &= ~CLONE_NEWNS;
 



More information about the CRIU mailing list