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

[Xen-changelog] [xen master] libxl: timeouts: Record deregistration when one occurs



commit 15347ebb357fe587c2f9e55bdeb5ef6af36b7958
Author:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
AuthorDate: Fri Jan 31 15:07:55 2014 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Thu Feb 6 14:24:16 2014 +0000

    libxl: timeouts: Record deregistration when one occurs
    
    When a timeout has occurred, it is deregistered.  However, we failed
    to record this fact by updating etime->func.  As a result,
    libxl__ev_time_isregistered would say `true' for a timeout which has
    already happened.
    
    It is necessary to clear etime->func before the callback, because the
    callback might want to reinstate the timeout, or might free the etime
    (or its containing struct) entirely.
    
    The results are that we might try to have the timeout occur again
    (causing problems for the call site), and/or corrupt the timeout list.
    
    This fixes the timedereg event system unit test.
    
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Cc: Jim Fehlig <jfehlig@xxxxxxxx>
    Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
    Acked-by: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
---
 tools/libxl/libxl_event.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index 5a99932..ea8c744 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -387,7 +387,9 @@ static void time_occurs(libxl__egc *egc, libxl__ev_time 
*etime)
         etime, (unsigned long)etime->abs.tv_sec,
         (unsigned long)etime->abs.tv_usec);
 
-    etime->func(egc, etime, &etime->abs);
+    libxl__ev_time_callback *func = etime->func;
+    etime->func = 0;
+    func(egc, etime, &etime->abs);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

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