[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] tools/xl: fix race which can leave an xl monitor



The patch below, which I have just applied, deals with a race during
"xl destroy" which can leave an xl process waiting.

While I was preparing this patch I noticed that the surrounding code
had a number of deficiencies, which I note down here for us to do
something about:
 * The "libxl_event_get_*" functions take a domid, when they should
   _return_ the domid of the affected domain.  The library's caller
   may be managing multiple domains.
 * The "libxl_event_get_*" functions do not actually look at the
   event (!) but rather get the information from somewhere else.  This
   means that there can be races where the event has a particular type
   but the information obtained by the getter function does not
   correspond at all.
 * libxl_domain_info provides no way for the caller to recognise "this
   domain no longer exists".  I would suggest a new flag bit
   "nodomain" in libxl_dominfo.  Consequentially
   libxl_event_get_domain_death_info ignores error returns from
   libxl_domain_info.

Ian.

# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1292521164 0
# Node ID 1800f15da48a81d63635ceb6ca77dacbf50dc303
# Parent  4b92c5ea284a26250c574235cc649ed3b2f6fbf6
tools/xl: fix race which can leave an xl monitor processing hanging

If the domain is destroyed (eg with xl destroy), it is possible that
the xl which is monitoring the domain for restart/preserve will not be
able to get the domain shutdown reason.

Before this patch, it would then ignore the domain death event and
carry on waiting, forever, for more events.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

diff -r 4b92c5ea284a -r 1800f15da48a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Dec 16 16:58:39 2010 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Dec 16 17:39:24 2010 +0000
@@ -1848,6 +1848,9 @@ start:
                         ret = 0;
                         goto out;
                     }
+                } else {
+                    LOG("Unable to get domain death info, quitting");
+                    goto out;
                 }
                 break;
             case LIBXL_EVENT_DISK_EJECT:

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.