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

[Xen-changelog] [xen stable-4.5] libxl: event handling: ao_inprogress does waits while reports outstanding



commit bf06e40002f9ce08cad9037bad6bf02568ffce1d
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Mon Feb 9 15:20:32 2015 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Fri Jun 12 12:45:03 2015 +0100

    libxl: event handling: ao_inprogress does waits while reports outstanding
    
    libxl__ao_inprogress needs to check (like
    libxl__ao_complete_check_progress_reports) that there are no
    oustanding progress callbacks.
    
    Otherwise it might happen that we would destroy the ao while another
    thread has an outstanding callback its egc report queue.  The other
    thread would then, in its egc_run_callbacks, touch the destroyed ao.
    
    Instead, when this happens in libxl__ao_inprogress, simply run round
    the event loop again.  The thread which eventually makes the callback
    will spot our poller in the ao, and notify the poller, waking us up.
    
    This fixes an assertion failure race seen with libvirt:
      libvirtd: libxl_event.c:1792: libxl__ao_complete_check_progress_reports: 
Assertion `ao->in_initiator' failed.
    or (after "Add an assert to egc_run_callbacks")
      libvirtd: libxl_event.c:1338: egc_run_callbacks: Assertion 
`aop->ao->magic == 0xA0FACE00ul' failed.
    
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
    CC: Wei Liu <wei.liu2@xxxxxxxxxx>
    CC: Jim Fehlig <jfehlig@xxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    (cherry picked from commit f1335f0d7b2402e94e0c6e8a905dc309edaafcfb)
---
 tools/libxl/libxl_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index 90ac033..9a7c644 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -1877,7 +1877,7 @@ int libxl__ao_inprogress(libxl__ao *ao,
         for (;;) {
             assert(ao->magic == LIBXL__AO_MAGIC);
 
-            if (ao->complete) {
+            if (!ao_work_outstanding(ao)) {
                 rc = ao->rc;
                 ao->notified = 1;
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.5

_______________________________________________
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®.