From: Ian Jackson Subject: Re: [PATCH 1/2] libxl: fix race in libxl__devices_destroy Date: Tue, 31 Jul 2012 15:44:12 +0100 Message-ID: <20503.61244.12965.821230@mariner.uk.xensource.com> References: <1343329975-33432-1-git-send-email-roger.pau@citrix.com> <1343329975-33432-2-git-send-email-roger.pau@citrix.com> <20498.39764.77835.293945@mariner.uk.xensource.com> <20498.56653.312571.205788@mariner.uk.xensource.com> <1343741218.25782.15.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1343741218.25782.15.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xen.org" , Roger Pau Monne List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [PATCH 1/2] libxl: fix race in libxl__devices_destroy"): > On Fri, 2012-07-27 at 19:26 +0100, Ian Jackson wrote: > > > +void libxl__multidev_prepared(libxl__egc *egc, libxl__ao_devices *aodevs, > > + int rc) > > +{ > > + multidev_one_callback(egc, aodevs->preparation); > > Don't we need to propagate rc here? Perhaps with > aodevs->preparation->rc= rc > ? Yes, good catch. This pattern where we have to explicitly assign to the rc in the aodev is perhaps less than ideal. I spotted a similar bug in one of Roger's patches. I wonder if there's a way to get around this. > > diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h > > index f0c94e8..7072b09 100644 > > --- a/tools/libxl/libxl_internal.h > > +++ b/tools/libxl/libxl_internal.h > > @@ -1810,20 +1810,6 @@ typedef void libxl__device_callback(libxl__egc*, libxl__ao_device*); > [...] > > +/* > > + * Multiple devices "multidevs" handling. > > + * > > + * Firstly, you should > > + * libxl__multidev_begin > > + * multidevs->callback = ... > > + * Then zero or more times > > + * libxl__multidev_prepare > > + * libal__initiate_device_{remove/addition}. > > + * Finally, once > > + * libxl__multidev_prepared > > + * which will result (perhaps reentrantly) in one call to callback(). > > Briefly mention the multidev vs ao_devices naming? Or just do the rename > now in a new patch. If you're happy with that renaming now then I will do the latter. Ian.