[CRIU] [PATCH] service: don't send dump response in case of self-dump without leave_running
Pavel Emelyanov
xemul at parallels.com
Thu Nov 28 12:03:51 PST 2013
On 11/26/2013 03:32 AM, Ruslan Kuprieiev wrote:
> 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;
Don't use static variable for that. Pass it over the stack or options.
> +
> 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;
The above means
- if (req->leave_running) {
+ if (self_dump || req->leave_running) {
hunk only. Plz, send _this_ patch and if you don't like the code flow --
send another cleaning one up.
> }
>
> return success ? 0 : 1;
>
Thanks,
Pavel
More information about the CRIU
mailing list