]> xenbits.xensource.com Git - pvdrivers/win/xenvbd.git/commitdiff
Clear unplug requests from co-installer 8.1.0-rc1
authorPaul Durrant <paul.durrant@citrix.com>
Thu, 3 Sep 2015 16:36:43 +0000 (17:36 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Thu, 3 Sep 2015 16:39:34 +0000 (17:39 +0100)
When XENVBD is uninstalled there is no suitable notification in kernel
which can be used to clear any remaining unplug requests. This leads to
a certain 0x7B bugcheck on reboot. This patch therefore does the job
from the co-installer since this seems to be the only way.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/coinst/coinst.c

index 90694356452510ac0bcad57fe26742bd773fe6f0..7f421c96afe391102b262bc64adf9a95e4bfd87a 100644 (file)
@@ -46,6 +46,9 @@ __user_code;
 #define SERVICE_KEY(_Driver)    \
         SERVICES_KEY ## "\\" ## #_Driver
 
+#define UNPLUG_KEY \
+        SERVICE_KEY(XEN) ## "\\Unplug"
+
 #define STATUS_KEY  \
         SERVICE_KEY(XENVBD) ## "\\Status"
 
@@ -182,6 +185,53 @@ __FunctionName(
 #undef  _NAME
 }
 
+static BOOLEAN
+ClearUnplugRequest(
+    IN  PTCHAR      ClassName
+    )
+{
+    HKEY            UnplugKey;
+    HRESULT         Error;
+
+    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                         UNPLUG_KEY,
+                         0,
+                         KEY_ALL_ACCESS,
+                         &UnplugKey);
+    if (Error != ERROR_SUCCESS) {
+        SetLastError(Error);
+        goto fail1;
+    }
+
+    Error = RegDeleteValue(UnplugKey, ClassName);
+    if (Error != ERROR_SUCCESS) {
+        SetLastError(Error);
+        goto fail2;
+    }
+
+    RegCloseKey(UnplugKey);
+
+    return TRUE;
+
+fail2:
+    Log("fail2");
+
+    RegCloseKey(UnplugKey);
+
+fail1:
+    Error = GetLastError();
+
+    {
+        PTCHAR  Message;
+
+        Message = __GetErrorMessage(Error);
+        Log("fail1 (%s)", Message);
+        LocalFree(Message);
+    }
+
+    return FALSE;
+}
+
 static BOOLEAN
 OverrideGroupPolicyOptions(
     )
@@ -566,7 +616,9 @@ __DifRemovePreProcess(
     UNREFERENCED_PARAMETER(DeviceInfoData);
     UNREFERENCED_PARAMETER(Context);
 
-    Log("====>");
+    Log("<===>");
+
+    (VOID) ClearUnplugRequest("DISKS");
 
     return NO_ERROR; 
 }