Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Vagin <avagin@openvz.org>2015-10-09 17:41:00 +0300
committerPavel Emelyanov <xemul@parallels.com>2015-10-22 16:20:07 +0300
commite36dbef13d9831e6ca0e1fded944f62e5b5f991f (patch)
treec637b5b7ccef2d41b1e5c05d76cdd6d4faae0720
parent275740a71eb73c50a5c9c7e56a63b7ca1dca20ae (diff)
restore: wait while processes are dying
If criu restore failed, criu should wait all processes because they hold files, namespaces and other stuff that caller might want to have released (in our case it was ploop device). Here we do this only for cases when processes are restored in a pid namespace. We'd like to do the same for non-ns case, but there's no simple way to wait for a bunch of unconnected processes. Another good side effect is that "Restoring FAILED." will be printed at the end of the log (now after we kill init tasks still have time to do smth and write log messages). Cc: Nikita Spiridonov <nspiridonov@odin.com> Reported-by: Nikita Spiridonov <nspiridonov@odin.com> Signed-off-by: Andrew Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
-rw-r--r--cr-restore.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cr-restore.c b/cr-restore.c
index b8b447399..9810014de 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1915,9 +1915,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;