[libvirt] [PATCH 6/6] libxl: Find domain object in event handler

Jim Fehlig jfehlig at suse.com
Thu Jan 24 19:45:21 UTC 2013


Jim Fehlig wrote:
> Since libxl provides the domain ID in the event handler callback,
> find the domain object based on the ID.  This approach prevents
> processing the callback on a domain that has already been reaped.
> ---
>  src/libxl/libxl_driver.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 7484b83..e28b641 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -656,22 +656,22 @@ libxlVmReap(libxlDriverPrivatePtr driver,
>   * Handle previously registered event notification from libxenlight
>   */
>  static void
> -libxlEventHandler(void *data, const libxl_event *event)
> +libxlEventHandler(void *data ATTRIBUTE_UNUSED, const libxl_event *event)
>  {
>      libxlDriverPrivatePtr driver = libxl_driver;
> -    virDomainObjPtr vm = data;
> +    virDomainObjPtr vm = NULL;
>      virDomainEventPtr dom_event = NULL;
>  
>      libxlDriverLock(driver);
>   

On xen-unstable, I noticed an occasional deadlock here when libxl
invokes the event handler with a SUSPEND shutdown reason.  The driver
lock is already held by the caller of libxl_domain_suspend().  Inspired
by the xl implementation, I've updated this patch to ignore the SUSPEND
shutdown reason before acquiring the driver lock.

Regards,
Jim


-------------- next part --------------
A non-text attachment was scrubbed...
Name: event-handler.patch
Type: text/x-patch
Size: 3092 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130124/d046f807/attachment-0001.bin>


More information about the libvir-list mailing list