All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <Ian.Jackson@eu.citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: [PATCH v3 5/7] libxl: introduce libxl__alloc_vdev
Date: Fri, 20 Apr 2012 15:28:59 +0100	[thread overview]
Message-ID: <20369.29355.670145.159299@mariner.uk.xensource.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1204201505500.26786@kaball-desktop>

Stefano Stabellini writes ("Re: [Xen-devel] [PATCH v3 5/7] libxl: introduce libxl__alloc_vdev"):
> On Tue, 17 Apr 2012, Ian Jackson wrote:
> > Stefano Stabellini writes ("[Xen-devel] [PATCH v3 5/7] libxl: introduce libxl__alloc_vdev"):
> > > +        devid = libxl__device_disk_dev_number(vdev, NULL, NULL);
> > > +        if (libxl__xs_read(gc, t,
> > > +                    libxl__sprintf(gc, "%s/device/vbd/%d/backend",
> > > +                        dompath, devid)) == NULL)
> > > +            return libxl__devid_to_vdev(gc, devid);
> > 
> > What if the error is not ENOENT ?
> 
> we should return NULL

I don't think that's correct.  If, say, the error is EACCES, then the
domain creation should be aborted with a message about that, since the
system has been installed incorrectly.

Compare this situation with the recent pygrub failure, where
libfsimage+pygrub turned all errors of the form "something went wrong
loading this plugin" into "the kernel was not found"; so when a
completely empty .so was loaded as a plugin the result was not "OMG
WTF this is totally broken" but "sorry can't find your kernel in this
filesystem" (when really the problem is that pygrub+libfsimage knew
that the filesystem was one they were supposed to support but the
plugin for it was utterly broken).

This reminds me of our other recent discussion about error handling,
of receiving unexpected toolstack migration info.  In general any
unanticipated situation should be treated as a fatal error.  Only
anticipated situations should result in the software continuing in a
degraded manner.

> > > +static char *encode_disk_name(char *ptr, unsigned int n)
> > 
> > There is no clearly defined upper bound on the buffer space needed by
> > this function.
> 
> I know but this function is used as is in Linux where the stack is
> even smaller. I'll add an upper bound anyway.

At the very least a comment is needed to demonstrate that it's
correct, but a bound in the code would be better.  (Also I'm surprised
that you chose a recursive rather than iterative implementation of a
what is a base conversion routine...)

> > > diff --git a/tools/libxl/libxl_netbsd.c b/tools/libxl/libxl_netbsd.c
> > > index 9e0ed6d..c8977ac 100644
> > > --- a/tools/libxl/libxl_netbsd.c
> > > +++ b/tools/libxl/libxl_netbsd.c
> > ...
> > > +char *libxl__devid_to_vdev(libxl__gc *gc, int devid)
> > > +{
> > > +    /* TODO */
> > > +    return NULL;
> > > +}
> > 
> > I guess this is going to be fixed in a future version of the patch ?
> 
> I don't think so: I don't know anything about netbsd and local_attach
> doesn't work there anyway.

What is the error behaviour if NULL is returned here ?  I forget the
rest of the patch, but once again we should make sure that we abort if
this situation occurs.

Ian.

  reply	other threads:[~2012-04-20 14:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 18:32 [PATCH v3 0/7] qdisk local attach Stefano Stabellini
2012-04-16 18:33 ` [PATCH v3 1/7] libxl: libxl__device_disk_local_attach return a new libxl_device_disk Stefano Stabellini
2012-04-17 17:25   ` Ian Jackson
2012-04-18  8:34     ` Ian Campbell
2012-04-20 13:58     ` Stefano Stabellini
2012-04-16 18:33 ` [PATCH v3 2/7] libxl: add a transaction parameter to libxl__device_generic_add Stefano Stabellini
2012-04-17 17:27   ` Ian Jackson
2012-04-18  8:41   ` Ian Campbell
2012-04-20 15:13     ` Stefano Stabellini
2012-04-16 18:33 ` [PATCH v3 3/7] libxl: introduce libxl__device_disk_add_t Stefano Stabellini
2012-04-17 17:37   ` Ian Jackson
2012-04-20 14:00     ` Stefano Stabellini
2012-04-16 18:33 ` [PATCH v3 4/7] xl/libxl: add a blkdev_start parameter Stefano Stabellini
2012-04-17 17:47   ` Ian Jackson
2012-04-20 14:04     ` Stefano Stabellini
2012-04-20 14:08       ` Ian Campbell
2012-04-23 17:40         ` Stefano Stabellini
2012-04-24  9:20           ` Ian Campbell
2012-04-20 14:22       ` Ian Jackson
2012-04-16 18:33 ` [PATCH v3 5/7] libxl: introduce libxl__alloc_vdev Stefano Stabellini
2012-04-17 17:53   ` Ian Jackson
2012-04-20 14:14     ` Stefano Stabellini
2012-04-20 14:28       ` Ian Jackson [this message]
2012-04-23 17:40         ` Stefano Stabellini
2012-04-16 18:33 ` [PATCH v3 6/7] xl/libxl: implement QDISK libxl_device_disk_local_attach Stefano Stabellini
2012-04-17 17:58   ` Ian Jackson
2012-04-20 14:24     ` Stefano Stabellini
2012-04-20 14:37       ` Ian Jackson
2012-04-23 17:40         ` Stefano Stabellini
2012-04-16 18:33 ` [PATCH v3 7/7] libxl__device_disk_local_attach: wait for state "connected" Stefano Stabellini
2012-04-17 18:01   ` Ian Jackson
2012-04-20 14:35     ` Stefano Stabellini

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=20369.29355.670145.159299@mariner.uk.xensource.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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.