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

[win-pv-devel] [PATCH 1/2] Prevent VIF from being incorrectly considered offline...



...one resume from suspend.

My previous reversion of 765b7a6a exposed the original reason the
reverted patch.

On resume from suspend, the backend will have been re-created by the
toolstack and hence the frontend detects it as being offline. This
causes the frontend to request ejection of the disk (thinking that
the reason for the backend going offline is because the VIF is being
unplugged).

This patch works around this problem by introducing an early suspend
callback to note that the frontend has actually gone offline, which
will prevent the ejection from being requested.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenvif/frontend.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index 9aa1d76..7840cb7 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -81,6 +81,7 @@ struct _XENVIF_FRONTEND {
     XENBUS_SUSPEND_INTERFACE    SuspendInterface;
     XENBUS_STORE_INTERFACE      StoreInterface;
 
+    PXENBUS_SUSPEND_CALLBACK    SuspendCallbackEarly;
     PXENBUS_SUSPEND_CALLBACK    SuspendCallbackLate;
     PXENBUS_DEBUG_CALLBACK      DebugCallback;
     PXENBUS_STORE_WATCH         Watch;
@@ -2235,6 +2236,16 @@ __FrontendSuspend(
 }
 
 static DECLSPEC_NOINLINE VOID
+FrontendSuspendCallbackEarly(
+    IN  PVOID           Argument
+    )
+{
+    PXENVIF_FRONTEND    Frontend = Argument;
+
+    Frontend->Online = FALSE;
+}
+
+static DECLSPEC_NOINLINE VOID
 FrontendSuspendCallbackLate(
     IN  PVOID           Argument
     )
@@ -2265,12 +2276,21 @@ FrontendResume(
 
     status = XENBUS_SUSPEND(Register,
                             &Frontend->SuspendInterface,
+                            SUSPEND_CALLBACK_EARLY,
+                            FrontendSuspendCallbackEarly,
+                            Frontend,
+                            &Frontend->SuspendCallbackEarly);
+    if (!NT_SUCCESS(status))
+        goto fail2;
+
+    status = XENBUS_SUSPEND(Register,
+                            &Frontend->SuspendInterface,
                             SUSPEND_CALLBACK_LATE,
                             FrontendSuspendCallbackLate,
                             Frontend,
                             &Frontend->SuspendCallbackLate);
     if (!NT_SUCCESS(status))
-        goto fail2;
+        goto fail3;
 
     KeLowerIrql(Irql);
 
@@ -2289,6 +2309,14 @@ FrontendResume(
 
     return STATUS_SUCCESS;
     
+fail3:
+    Error("fail3\n");
+
+    XENBUS_SUSPEND(Deregister,
+                   &Frontend->SuspendInterface,
+                   Frontend->SuspendCallbackEarly);
+    Frontend->SuspendCallbackEarly = NULL;
+
 fail2:
     Error("fail2\n");
 
@@ -2320,6 +2348,11 @@ FrontendSuspend(
                    Frontend->SuspendCallbackLate);
     Frontend->SuspendCallbackLate = NULL;
 
+    XENBUS_SUSPEND(Deregister,
+                   &Frontend->SuspendInterface,
+                   Frontend->SuspendCallbackEarly);
+    Frontend->SuspendCallbackEarly = NULL;
+
     __FrontendSuspend(Frontend);
 
     XENBUS_SUSPEND(Release, &Frontend->SuspendInterface);
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://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®.