[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. Signed-off-by: David Buches <davebuch@xxxxxxxxxx> --- src/xen/sched.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/xen/sched.c b/src/xen/sched.c index 07e03ce..70da7d1 100644 --- a/src/xen/sched.c +++ b/src/xen/sched.c @@ -84,22 +84,29 @@ SchedShutdown( { struct sched_shutdown op; LONG_PTR rc; - NTSTATUS status; + NTSTATUS status = STATUS_SUCCESS; op.reason = Reason; rc = SchedOp(SCHEDOP_shutdown, &op); - + if (rc < 0) { ERRNO_TO_STATUS(-rc, status); goto fail1; } - return STATUS_SUCCESS; + /* + * When a SCHEDOP_shutdown hypercall is issued with SHUTDOWN_suspend + * reason code, a return value of 1 indicates that the operation was cancelled + */ + if(Reason == SHUTDOWN_suspend && rc == 1) { + status = STATUS_CANCELLED; + } -fail1: - Error("fail1 (%08x)\n", status); + return status; +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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |