All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wen Congyang <wency@cn.fujitsu.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jiang Yunhong <yunhong.jiang@intel.com>,
	Dong Eddie <eddie.dong@intel.com>,
	xen devel <xen-devel@lists.xen.org>,
	Yang Hongyang <yanghy@cn.fujitsu.com>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: [Patch v2 2/3] correct xc_domain_save()'s return value
Date: Mon, 17 Nov 2014 09:26:02 +0800	[thread overview]
Message-ID: <54694EAA.7080403@cn.fujitsu.com> (raw)
In-Reply-To: <21606.6212.353346.560825@mariner.uk.xensource.com>

On 11/14/2014 10:57 PM, Ian Jackson wrote:
> Wen Congyang writes ("[Patch v2 2/3] correct xc_domain_save()'s return value"):
>> If suspend_and_state() fails, the errno may be 0. But we assume
>> that the errno is not 0. So remove assert().
> 
> Thanks for spotting this.
> 
> I think this is going in the wrong direction.  Perhaps we could
> instead do something like the patch below ?  Please let me know what
> you think.
> 
> If you think this is a better idea, please submit it as a proper patch
> with a proper commit message.

OK, I will do it.

> 
> (Ideally we would fix the actual suspend hook in libxl, to always set
> errno, but that's too invasive a set of changes to do now, I think.)

libxl and helper program are two programs, and we should update the interface
between libxl and the hepler program first. We can do it later.

Thanks
Wen Congyang

> 
> Thanks,
> Ian.
> 
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
> index 40bbac8..3ab9dd8 100644
> --- a/tools/libxc/include/xenguest.h
> +++ b/tools/libxc/include/xenguest.h
> @@ -35,7 +35,9 @@
>  /* callbacks provided by xc_domain_save */
>  struct save_callbacks {
>      /* Called after expiration of checkpoint interval,
> -     * to suspend the guest.
> +     * to suspend the guest.  Returns 1 for success, or 0 for failure.
> +     * On failure it should ideally set errno.  (If it leaves errno
> +     * as 0, EIO will be used instead.)
>       */
>      int (*suspend)(void* data);
>  
> diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
> index 254fdb3..444aac6 100644
> --- a/tools/libxc/xc_domain_save.c
> +++ b/tools/libxc/xc_domain_save.c
> @@ -361,9 +361,15 @@ static int suspend_and_state(int (*suspend)(void*), void* data,
>                               xc_interface *xch, int io_fd, int dom,
>                               xc_dominfo_t *info)
>  {
> +    errno = 0;
>      if ( !(*suspend)(data) )
>      {
> -        ERROR("Suspend request failed");
> +        if (!errno) {
> +            errno = EIO;
> +            ERROR("Suspend request failed (without errno, using EINVAL)");
> +        } else {
> +            ERROR("Suspend request failed");
> +        }
>          return -1;
>      }
>  
> .
> 

  parent reply	other threads:[~2014-11-17  1:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09  2:05 [Patch v2 0/3] Some bugfix patches Wen Congyang
2014-10-09  2:05 ` [Patch v2 1/3] check if mfn is supported by IOCTL_PRIVCMD_MMAPBATCH before calling ioctl() Wen Congyang
2014-10-09  2:05 ` [Patch v2 2/3] correct xc_domain_save()'s return value Wen Congyang
2014-11-14 14:57   ` Ian Jackson
2014-11-14 14:58     ` Ian Campbell
2014-11-14 15:08       ` Ian Jackson
2014-11-17  1:26     ` Wen Congyang [this message]
2014-10-09  2:05 ` [Patch v2 3/3] update libxl__device_disk_from_xs_be() to support blktap device Wen Congyang
2014-11-14 15:07   ` Ian Jackson
2014-11-10 11:43 ` [Patch v2 0/3] Some bugfix patches 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=54694EAA.7080403@cn.fujitsu.com \
    --to=wency@cn.fujitsu.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=eddie.dong@intel.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yanghy@cn.fujitsu.com \
    --cc=yunhong.jiang@intel.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.