[CRIU] [PATCH] restore: wait while processes are dying

Andrey Vagin avagin at openvz.org
Fri Oct 9 07:41:15 PDT 2015


From: Andrew Vagin <avagin at openvz.org>

If criu restore failed, criu should wait all processes.

Here we do this only for cases when processes are restored in a pid namespace.

"Restoring FAILED." will be printed at the end of the log.

Cc: Nikita Spiridonov <nspiridonov at odin.com>
Reported-by: Nikita Spiridonov <nspiridonov at odin.com>
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 cr-restore.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cr-restore.c b/cr-restore.c
index fb86114..73097a9 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1940,9 +1940,15 @@ out_kill:
 	 * otherwise an external proccesses can be killed.
 	 */
 	if (root_ns_mask & CLONE_NEWPID) {
+		int status;
+
 		/* Kill init */
 		if (root_item->pid.real > 0)
 			kill(root_item->pid.real, SIGKILL);
+
+		if (waitpid(root_item->pid.real, &status, 0) < 0)
+			pr_warn("Unable to wait %d: %s",
+				root_item->pid.real, strerror(errno));
 	} else {
 		struct pstree_item *pi;
 
-- 
2.4.3



More information about the CRIU mailing list