[CRIU] [PATCH 1/3] seize: detach from all processes before waiting the root task

Andrey Vagin avagin at openvz.org
Fri Jan 15 18:57:52 PST 2016


From: Andrew Vagin <avagin at virtuozzo.com>

We need to detach from all processes before waiting the root
task, because one of these processes may collect processes from a
target pid namespace. The pid namespace is destroyed only when all
processes have been killed and collected.

https://jira.sw.ru/browse/PSBM-43089
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 seize.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/seize.c b/seize.c
index 7e93d34..18f0d40 100644
--- a/seize.c
+++ b/seize.c
@@ -452,10 +452,16 @@ void pstree_switch_state(struct pstree_item *root_item, int st)
 	for_each_pstree_item(item)
 		unseize_task_and_threads(item, st);
 
+	/*
+	 * We need to detach from all processes before waiting the init
+	 * process, because one of these processes may collect processes from a
+	 * target pid namespace. The pid namespace is destroyed only when all
+	 * processes have been killed and collected.
+	 */
+	freezer_detach();
+
 	if (st == TASK_DEAD)
 		pstree_wait(root_item);
-
-	freezer_detach();
 }
 
 static pid_t item_ppid(const struct pstree_item *item)
-- 
2.4.3



More information about the CRIU mailing list