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

[Xen-changelog] [xen stable-4.4] libxl: In domain death search, start search at first domid we want



commit 13623d5d8e854f20b2da885f4d452dc870912205
Author:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
AuthorDate: Tue Mar 17 09:30:57 2015 -0600
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Tue Jun 23 11:50:49 2015 +0100

    libxl: In domain death search, start search at first domid we want
    
    From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    
    When domain_death_xswatch_callback needed a further call to
    xc_domain_getinfolist it would restart it with the last domain it
    found rather than the first one it wants.
    
    If it only wants one it will also only ask for one domain.  The result
    would then be that it gets the previous domain again (ie, the previous
    one to the one it wants), which still doesn't reveal the answer to the
    question, and it would therefore loop again.
    
    It's completely unclear to me why I thought it was a good idea to
    start the xc_domain_getinfolist with the last domain previously found
    rather than the first one left un-confirmed.  The code has been that
    way since it was introduced.
    
    Instead, start each xc_domain_getinfolist at the next domain whose
    status we need to check.
    
    We also need to move the test for !evg into the loop, we now need evg
    to compute the arguments to getinfolist.
    
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    Reported-by: Jim Fehlig <jfehlig@xxxxxxxx>
    Reviewed-by: Jim Fehlig <jfehlig@xxxxxxxx>
    Tested-by: Jim Fehlig <jfehlig@xxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    (cherry picked from commit 4783c99aab866f470bd59368cfbf5ad5f677b0ec)
    (cherry picked from commit 0b19348f3cd176e4badb173dd0054c49346a6ce1)
---
 tools/libxl/libxl.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 59e3292..2805e6c 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -976,22 +976,20 @@ static void domain_death_xswatch_callback(libxl__egc 
*egc, libxl__ev_xswatch *w,
                                         const char *wpath, const char *epath) {
     EGC_GC;
     libxl_evgen_domain_death *evg;
-    uint32_t domid;
     int rc;
 
     CTX_LOCK;
 
     evg = LIBXL_TAILQ_FIRST(&CTX->death_list);
-    if (!evg) goto out;
-
-    domid = evg->domid;
 
     for (;;) {
+        if (!evg) goto out;
+
         int nentries = LIBXL_TAILQ_NEXT(evg, entry) ? 200 : 1;
         xc_domaininfo_t domaininfos[nentries];
         const xc_domaininfo_t *got = domaininfos, *gotend;
 
-        rc = xc_domain_getinfolist(CTX->xch, domid, nentries, domaininfos);
+        rc = xc_domain_getinfolist(CTX->xch, evg->domid, nentries, 
domaininfos);
         if (rc == -1) {
             LIBXL__EVENT_DISASTER(egc, "xc_domain_getinfolist failed while"
                                   " processing @releaseDomain watch event",
@@ -1001,8 +999,10 @@ static void domain_death_xswatch_callback(libxl__egc 
*egc, libxl__ev_xswatch *w,
         gotend = &domaininfos[rc];
 
         LIBXL__LOG(CTX, LIBXL__LOG_DEBUG, "[evg=%p:%"PRIu32"]"
-                   " from domid=%"PRIu32" nentries=%d rc=%d",
-                   evg, evg->domid, domid, nentries, rc);
+                   " nentries=%d rc=%d %ld..%ld",
+                   evg, evg->domid, nentries, rc,
+                   rc>0 ? (long)domaininfos[0].domain : 0,
+                   rc>0 ? (long)domaininfos[rc-1].domain : 0);
 
         for (;;) {
             if (!evg) {
@@ -1065,7 +1065,6 @@ static void domain_death_xswatch_callback(libxl__egc 
*egc, libxl__ev_xswatch *w,
         }
 
         assert(rc); /* rc==0 results in us eating all evgs and quitting */
-        domid = gotend[-1].domain;
     }
  all_reported:
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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