restore: Wait for userns being prepared before moving into cgroups (v3)

Submitted by Andrei Vagin on April 21, 2016, 3:34 p.m.

Details

Message ID 1461252849-4794-1-git-send-email-avagin@openvz.org
State Accepted
Series "restore: Wait for userns being prepared before moving into cgroups (v3)"
Commit 81d9b571c04fa3996dc3038bf2e5703ef95590fb
Headers show

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 34db7f7..6ee0850 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1663,6 +1663,11 @@  static int restore_task_with_children(void *_arg)
 			goto err;
 	}
 
+	/* Wait prepare_userns */
+	if (current->parent == NULL &&
+            restore_finish_stage(CR_STATE_RESTORE_NS) < 0)
+			goto err;
+
 	/*
 	 * Call this _before_ forking to optimize cgroups
 	 * restore -- if all tasks live in one set of cgroups
@@ -1679,9 +1684,6 @@  static int restore_task_with_children(void *_arg)
 			goto err;
 		}
 
-		if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0)
-			goto err;
-
 		pr_info("Calling restore_sid() for init\n");
 		restore_sid();
 

Comments

Pavel Emelianov April 22, 2016, 1:39 p.m.
Applied, thanks