Commit 14da0f78 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

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: 's avatarNikita Spiridonov <nspiridonov@odin.com>
Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 135659e0
......@@ -1933,9 +1933,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment