]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Add missing acquisition of the UNPLUG interface
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 6 Oct 2014 16:37:16 +0000 (17:37 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 6 Oct 2014 16:37:16 +0000 (17:37 +0100)
Commit cba6dad2df306885dfc65908f14ce6e2d8a86211 changed the way that
emulated devices are unplugged. It used to be that XENFILT waited until it
detected the presence of the 'active' device that XENBUS bound to before
deciding whether to unplug, but that commit simply made sure that the
'active' device always appears unless something has drastically changed in
the VM configuration. Unfortunately, in making that change, the code that
acquired the initial reference to the unplug interface - and thereby caused
emulated devices to be unplugged - was lost. This patch adds in the missing
acquisition.

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

index 01661aa14cb7500490c325ce691a6e9adc437f0b..86c680017c1709621885b972b6c59b98e291868f 100644 (file)
@@ -59,7 +59,6 @@ typedef struct _XENFILT_DRIVER {
 
     XENFILT_EMULATED_INTERFACE  EmulatedInterface;
     XENFILT_UNPLUG_INTERFACE    UnplugInterface;
-    BOOLEAN                     UnplugAcquired;
 } XENFILT_DRIVER, *PXENFILT_DRIVER;
 
 static XENFILT_DRIVER   Driver;
@@ -305,10 +304,7 @@ DriverUnload(
     if (*InitSafeBootMode > 0)
         goto done;
 
-    if (Driver.UnplugAcquired) {
-        XENFILT_UNPLUG(Release, &Driver.UnplugInterface);
-        Driver.UnplugAcquired = FALSE;
-    }
+    XENFILT_UNPLUG(Release, &Driver.UnplugInterface);
 
     XENFILT_EMULATED(Release, &Driver.EmulatedInterface);
 
@@ -679,6 +675,10 @@ DriverEntry(
     if (!NT_SUCCESS(status))
         goto fail8;
 
+    status = XENFILT_UNPLUG(Acquire, &Driver.UnplugInterface);
+    if (!NT_SUCCESS(status))
+        goto fail9;
+
     RegistryCloseKey(ServiceKey);
 
     DriverObject->DriverExtension->AddDevice = DriverAddDevice;
@@ -693,6 +693,11 @@ done:
     Trace("<====\n");
     return STATUS_SUCCESS;
 
+fail9:
+    Error("fail9\n");
+
+    XENFILT_EMULATED(Release, &Driver.EmulatedInterface);
+
 fail8:
     Error("fail8\n");