From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Pau Monne Subject: Re: [PATCH v2 07/15] libxl: convert libxl_domain_destroy to an async op Date: Tue, 22 May 2012 18:30:12 +0100 Message-ID: <4FBBCD24.5050604@citrix.com> References: <1337695365-5142-1-git-send-email-roger.pau@citrix.com> <1337695365-5142-8-git-send-email-roger.pau@citrix.com> <20411.50812.100404.117424@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20411.50812.100404.117424@mariner.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 Jackson Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Jackson wrote: [...] I will apply the block of changes that I've removed from this reply. >> +static void device_remove_callback(libxl__egc *egc, libxl__ao_device *aorm) >> +{ >> + STATE_AO_GC(aorm->ao); >> + libxl__devices_remove_state *drs = CONTAINER_OF(aorm->base, *drs, aorm); >> + char *be_path = libxl__device_backend_path(gc, aorm->dev); >> + char *fe_path = libxl__device_frontend_path(gc, aorm->dev); >> + xs_transaction_t t = 0; >> + int rc = 0, last = 1; >> + >> +retry_transaction: >> + t = xs_transaction_start(CTX->xsh); >> + if (aorm->action == DEVICE_DISCONNECT) { >> + libxl__xs_path_cleanup(gc, t, fe_path); >> + libxl__xs_path_cleanup(gc, t, be_path); >> + } >> + if (!xs_transaction_end(CTX->xsh, t, 0)) { >> + if (errno == EAGAIN) >> + goto retry_transaction; >> + else { >> + rc = ERROR_FAIL; >> + goto out; >> + } >> + } >> + >> +out: >> + rc = libxl__ao_device_check_last(gc, aorm, drs->aorm, >> + drs->num_devices,&last); >> + if (last) >> + drs->callback(egc, drs, rc); >> + return; > > I don't understand why this is here in this patch. Surely it belongs > in the previous one ? Not really, because libxl__destroy_devices is called from libxl_domain_destroy, which does not ao until this patch, so this callback is the libxl__devices_destroy one (which was not async in previous patches), since it called libxl__device_destroy instead of libxl__initiate_device_remove. Thanks for the review.