From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Pau Monne Subject: Re: [PATCH v8 08/11] xl/libxl: implement QDISK libxl_device_disk_local_attach Date: Thu, 7 Jun 2012 19:56:35 +0200 Message-ID: <4FD0EB53.2040603@citrix.com> References: <1338287956-24691-8-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1338287956-24691-8-git-send-email-stefano.stabellini@eu.citrix.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: Stefano Stabellini Cc: "xen-devel@lists.xensource.com" , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Stefano Stabellini wrote: > int libxl__device_disk_local_detach(libxl__gc *gc, libxl_device_disk *disk) > { > - /* Nothing to do for PHYSTYPE_PHY. */ > + int rc = 0; > > - /* > - * For other device types assume that the blktap2 process is > - * needed by the soon to be started domain and do nothing. > - */ > + switch (disk->backend) { > + case LIBXL_DISK_BACKEND_QDISK: > + if (disk->vdev != NULL) { > + libxl_device_disk_remove(gc->owner, LIBXL_TOOLSTACK_DOMID, > + disk, 0); I was just looking at this code, and I have the feeling this could be dangerous, since you call libxl__device_disk_local_detach from an already running ao (the bootloader ao), and libxl_device_disk_remove will initiate another ao, and set it to completed inside of an already running ao. > + rc = libxl_device_disk_destroy(gc->owner, > + LIBXL_TOOLSTACK_DOMID, disk); > + } > + break; > + default: > + /* > + * Nothing to do for PHYSTYPE_PHY. > + * For other device types assume that the blktap2 process is > + * needed by the soon to be started domain and do nothing. > + */ > + break; > + } > > free(disk->pdev_path); > free(disk->script); > - return 0; > + > + return rc; > } > > /******************************************************************************/