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

[win-pv-devel] [PATCH 5/7] Install filters on first FDO creation and remove on last deletion



When XENBUS binds to two devices (as it may when the vendor PCI device
is present) then installing/removing filters on a per-FDO basis does not
work properly.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenbus/driver.c | 13 +++++++++++--
 src/xenbus/fdo.c    |  4 ----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/xenbus/driver.c b/src/xenbus/driver.c
index 3409270..46712e3 100644
--- a/src/xenbus/driver.c
+++ b/src/xenbus/driver.c
@@ -39,6 +39,7 @@
 #include "driver.h"
 #include "names.h"
 #include "mutex.h"
+#include "filters.h"
 #include "dbg_print.h"
 #include "assert.h"
 #include "util.h"
@@ -193,13 +194,17 @@ DriverAddFunctionDeviceObject(
 {
     PDEVICE_OBJECT  DeviceObject;
     PXENBUS_DX      Dx;
+    ULONG           References;
 
     DeviceObject = FdoGetDeviceObject(Fdo);
     Dx = (PXENBUS_DX)DeviceObject->DeviceExtension;
     ASSERT3U(Dx->Type, ==, FUNCTION_DEVICE_OBJECT);
 
     InsertTailList(&Driver.List, &Dx->ListEntry);
-    Driver.References++;
+    References = Driver.References++;
+
+    if (References == 1)
+        FiltersInstall();
 }
 
 VOID
@@ -209,6 +214,7 @@ DriverRemoveFunctionDeviceObject(
 {
     PDEVICE_OBJECT  DeviceObject;
     PXENBUS_DX      Dx;
+    ULONG           References;
 
     DeviceObject = FdoGetDeviceObject(Fdo);
     Dx = (PXENBUS_DX)DeviceObject->DeviceExtension;
@@ -216,7 +222,10 @@ DriverRemoveFunctionDeviceObject(
 
     RemoveEntryList(&Dx->ListEntry);
     ASSERT3U(Driver.References, !=, 0);
-    --Driver.References;
+    References = --Driver.References;
+
+    if (References == 1)
+        FiltersUninstall();
 }
 
 DRIVER_UNLOAD       DriverUnload;
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 5d03f8c..1e55381 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -59,7 +59,6 @@
 #include "driver.h"
 #include "range_set.h"
 #include "unplug.h"
-#include "filters.h"
 #include "dbg_print.h"
 #include "assert.h"
 #include "util.h"
@@ -4837,7 +4836,6 @@ FdoCreate(
         goto fail8;
 
     if (Fdo->PvdeviceInterface.Interface.Context == NULL) {
-        (VOID) FiltersInstall();
         DriverRequestReboot();
         goto done;
     }
@@ -5148,8 +5146,6 @@ FdoDestroy(
         FdoClearActive(Fdo);
     }
 
-    (VOID) FiltersUninstall();
-
     RtlZeroMemory(&Fdo->PvdeviceInterface,
                   sizeof (XENFILT_PVDEVICE_INTERFACE));
 
-- 
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®.