[CRIU] [PATCH 08/15] service: don't include pstree.h
Andrey Vagin
avagin at openvz.org
Mon Nov 4 22:00:30 PST 2013
and don't try to send response, if tasks are not restored.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
cr-restore.c | 8 ++++++--
cr-service.c | 9 +++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/cr-restore.c b/cr-restore.c
index 761099a..4ab733c 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1429,6 +1429,7 @@ detach:
}
}
+/* This function returns pid of the root task in success case. */
static int restore_root_task(struct pstree_item *init)
{
int ret, fd;
@@ -1575,7 +1576,7 @@ out_kill:
out:
__restore_switch_stage(CR_STATE_FAIL);
pr_err("Restoring FAILED.\n");
- return 1;
+ return -1;
}
static int prepare_task_entries()
@@ -1622,7 +1623,10 @@ int cr_restore_tasks(void)
if (crtools_prepare_shared() < 0)
return -1;
- return restore_root_task(root_item);
+ if (restore_root_task(root_item))
+ return -1;
+
+ return root_item->pid.real;
}
/*
diff --git a/cr-service.c b/cr-service.c
index 1c14466..264ee54 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -16,7 +16,6 @@
#include "crtools.h"
#include "util-pie.h"
#include "log.h"
-#include "pstree.h"
#include "cr-service.h"
unsigned int service_sk_ino = -1;
@@ -190,6 +189,7 @@ exit:
static int restore_using_req(int sk, CriuOpts *req)
{
+ int pid;
bool success = false;
/*
@@ -205,16 +205,17 @@ static int restore_using_req(int sk, CriuOpts *req)
goto exit;
}
- if (cr_restore_tasks())
+ pid = cr_restore_tasks();
+ if (pid < 0)
goto exit;
success = true;
-exit:
- if (send_criu_restore_resp(sk, success, root_item->pid.real) == -1) {
+ if (send_criu_restore_resp(sk, success, pid) == -1) {
pr_perror("Can't send response");
success = false;
}
+exit:
return success ? 0 : 1;
}
--
1.8.3.1
More information about the CRIU
mailing list