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

[win-pv-devel] [PATCH] Fixed improper translation of SCHEDOP_Shutdown return code



The documentation for the SCHEDOP_Shutdown hyper-call states that when
invoked with the SHUTDOWN_Suspend reason code, the return value indicates
that the guest domain either suspended (and resumed) in a new domain (0),
or that the operation was canceled (1).

The problem - the SchedShutdown() wrapper wasn't properly translating the
return value for SHUTDOWN_Suspend - it returned a success value for both
successful and canceled suspend operations, which resulted in suspend
callbacks erroneously being invoked for canceled operations, producing
undesirable side effects (suspend callbacks are only supposed to be
invoked when resuming on a new domain).

The code now returns an appropriate status value when SHUTDOWN_Suspend
operations are canceled.
---
 src/xen/sched.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/xen/sched.c b/src/xen/sched.c
index 07e03ce..3adede7 100644
--- a/src/xen/sched.c
+++ b/src/xen/sched.c
@@ -92,13 +92,16 @@ SchedShutdown(
     
     if (rc < 0) {
         ERRNO_TO_STATUS(-rc, status);
-        goto fail1;
+        Error("SCHEDOP_shutdown(%d) failed. (%08x)\n", Reason, status);
+    }
+    else { 
+        /*
+         * When a SCHEDOP_shutdown hypercall is issued with SHUTDOWN_suspend 
+         * reason, return value of 1 indicates that the operation was cancelled
+         */
+        status = (SHUTDOWN_suspend == Reason && 1 == rc) ? 
+                            STATUS_CANCELLED : STATUS_SUCCESS;
     }
-
-    return STATUS_SUCCESS;
-
-fail1:
-    Error("fail1 (%08x)\n", status);
 
     return status;
 }
-- 
2.10.2.windows.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

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