[CRIU] [PATCH] service: don't send dump response in case of self-dump without leave_running

Ruslan Kuprieiev kupruser at gmail.com
Mon Nov 25 15:32:32 PST 2013


Currently we have a bug: if no leave_running is set in request, service won't send dump response. We must not send response only if it was a self-dump request and no leave_running option was set.

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 cr-service.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/cr-service.c b/cr-service.c
index eba5342..322f079 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -91,6 +91,8 @@ int send_criu_restore_resp(int socket_fd, bool success, int pid)
 	return send_criu_msg(socket_fd, &msg);
 }
 
+static bool self_dump;
+
 static int setup_opts_from_req(int sk, CriuOpts *req)
 {
 	struct ucred ids;
@@ -141,6 +143,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 		opts.final_state = TASK_ALIVE;
 
 	if (!req->has_pid) {
+		self_dump = true;
 		req->has_pid = true;
 		req->pid = ids.pid;
 	}
@@ -175,13 +178,14 @@ static int dump_using_req(int sk, CriuOpts *req)
 	if (cr_dump_tasks(req->pid) == -1)
 		goto exit;
 
-	if (req->has_leave_running && req->leave_running) {
-		success = true;
+	success = true;
 exit:
-		if (send_criu_dump_resp(sk, success, false) == -1) {
-			pr_perror("Can't send response");
-			success = false;
-		}
+	if (self_dump && !(req->has_leave_running && req->leave_running))
+		return success ? 0 : 1;
+
+	if (send_criu_dump_resp(sk, success, false) == -1) {
+		pr_perror("Can't send response");
+		success = false;
 	}
 
 	return success ? 0 : 1;
-- 
1.8.1.2



More information about the CRIU mailing list