From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: Re: [PATCH 08/11] libxl: Asynchronous/long-running operation infrastructure Date: Fri, 17 Feb 2012 16:12:53 +0000 Message-ID: <20286.31877.938411.558236@mariner.uk.xensource.com> References: <1327598457-28261-1-git-send-email-ian.jackson@eu.citrix.com> <1327598457-28261-9-git-send-email-ian.jackson@eu.citrix.com> <20283.43607.571172.475948@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Roger Pau =?iso-8859-1?Q?Monn=E9?= Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Roger Pau Monn=E9 writes ("Re: [Xen-devel] [PATCH 08/11] libxl: Asynchronou= s/long-running operation infrastructure"): > 2012/2/15 Ian Jackson : > > How are you expecting this ao to complete ? > = > I was expecting that AO_INPROGRESS returns 0 if no events have been > added, so I don't need to know whether I have added events or not to > call AO_INPROGRESS. You must always call AO_INPROGRESS. After calling AO_CREATE you must call AO_INPROGRESS. You must also arrange to call libxl__ao_complete at some point. You may only call libxl__ao_complete from an event callback. So you had better have set up an event ("added" an event as you put it). Otherwise libxl__ao_complete will never be called at all, and indeed the synchronous call will never return. > > If you haven't asked for > > an event callback then presumably libxl__ao_complete will never be > > called. > = > I'm talking about libxl__ao_inprogress, which is called from > AO_INPROGRESS macro. With the current code this macro might be called > from libxl_device_disk_remove for example without adding any events, > because libxl__initiate_device_remove can return successfully without > adding an event, and AO_INPROGRESS is called unconditionally. Yes, you are right, there is a bug in libxl_device_disk_remove / libxl__initiate_device_remove. I hadn't spotted that the "out" path from the old device removal code was used in a success case too. I will fix it. Ian.