All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Yang Hongyang <yanghy@cn.fujitsu.com>, xen-devel@lists.xen.org
Cc: Jason Andryuk <andryuk@aero.org>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH] libxl: Rewind toolstack_save_fd in libxl_save_helper when using remus
Date: Fri, 20 Jun 2014 11:23:22 +0100	[thread overview]
Message-ID: <53A40B9A.5020902@citrix.com> (raw)
In-Reply-To: <1403247574-14304-1-git-send-email-yanghy@cn.fujitsu.com>

On 20/06/14 07:59, Yang Hongyang wrote:
> commit(b327a3f421bb57d262b7d1fb3c43b710852b103b) move the rewinding
> of toolstack_save_fd to libxl, this breaks remus, because in remus
> mode, toolstack_save_cb will be called in every checkpoint, if
> we don't rewind it in libxl_save_helper, it will surely encounted
> error.
>
> I know this fix is just a hack, in fact the whole toolstack save
> thing should be done in libxl. But this fix should solve Jason's
> case and remus thing. Until migration v2 is upstreamed, this fix
> should be fine.
>
> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
> CC: Jason Andryuk <andryuk@aero.org>
> CC: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Ian Jackson <ian.jackson@eu.citrix.com>

Hmm - this is very hacky, but I don't see an alternative.

As b327a3f421 did regress remus, this fix should be taken.  It will only
be temporary until the libxl layering violation fixes from migration v2
appear.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>


> ---
>  tools/libxl/libxl_save_helper.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helper.c
> index b259bd0..4619fa3 100644
> --- a/tools/libxl/libxl_save_helper.c
> +++ b/tools/libxl/libxl_save_helper.c
> @@ -159,6 +159,7 @@ int helper_getreply(void *user)
>  
>  static int toolstack_save_fd;
>  static uint32_t toolstack_save_len;
> +static struct save_callbacks helper_save_callbacks;
>  
>  static int toolstack_save_cb(uint32_t domid, uint8_t **buf,
>                               uint32_t *len, void *data)
> @@ -167,6 +168,12 @@ static int toolstack_save_cb(uint32_t domid, uint8_t **buf,
>  
>      assert(toolstack_save_fd > 0);
>  
> +    /* This is a hack for remus */
> +    if (helper_save_callbacks.checkpoint) {
> +        r = lseek(toolstack_save_fd, 0, SEEK_SET);
> +        if (r) fail(errno,"rewind toolstack data tmpfile");
> +    }
> +
>      *buf = xmalloc(toolstack_save_len);
>      r = read_exactly(toolstack_save_fd, *buf, toolstack_save_len);
>      if (r<0) fail(errno,"read toolstack data");
> @@ -191,7 +198,6 @@ static void complete(int retval) {
>      exit(0);
>  }
>  
> -static struct save_callbacks helper_save_callbacks;
>  static struct restore_callbacks helper_restore_callbacks;
>  
>  int main(int argc, char **argv)

  reply	other threads:[~2014-06-20 10:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20  6:59 [PATCH] libxl: Rewind toolstack_save_fd in libxl_save_helper when using remus Yang Hongyang
2014-06-20 10:23 ` Andrew Cooper [this message]
2014-06-20 12:50 ` Jason Andryuk
2014-06-23 17:01   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53A40B9A.5020902@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=andryuk@aero.org \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yanghy@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.