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

[win-pv-devel] [PATCH 1/3] Avoid removing filters on upgrade installations


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Paul Durrant <paul.durrant@xxxxxxxxxx>
  • Date: Mon, 20 May 2019 17:46:15 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@xxxxxxxxxx; spf=Pass smtp.mailfrom=Paul.Durrant@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxxxxxxxxxxxxx
  • Cc: Paul Durrant <paul.durrant@xxxxxxxxxx>
  • Delivery-date: Mon, 20 May 2019 16:46:43 +0000
  • Ironport-sdr: vLe4PwVKbHV0Iiu4R/XjHT+N4MSYOZVwaXvKy8r8h0BG+bxcRfClygJPVv4t9H0anOngRSV4rQ dt1WXGIA71/G/7lA2fVTj32nn7qAsyPL6EbRSOf4KuW6VVPSH1kSvR+pNHR7a5HDfrLMdyODA7 QwVgXH4PsKa343odUDhStqvqz5QQm0VR6F29dhv6c2XJbm+5Jamsto7CUeI+offde/UGZ93UFu h5ldVhDycKkOEJv9oRzLh6FrXRoB+0mnX8kGx3zDbVMzh0A4svC/8+hAQPSzLTljVh6ZyIJ1Wq FPQ=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

When upgrading XENBUS in a situation where XENVBD has made it uninstallable
(without reboot), DriverRemoveFunctionDeviceObject() in the old instance of
XENBUS will cause XENFILT to be removed as PCI and IDE upper filter. Then,
when the new instance of XENBUS starts, it will find an incompatible
version of XEN prior to adding the registery filter entries back in. Thus,
after the requested reboot XENFILT will non-functional and another reboot
will be required to re-instate it.

This patch removes the call to FiltersUninstall() from
DriverRemoveFunctionDeviceObject() and, instead, calls it from
DriverEntry() AFTER the compatibility check. This means that XENFILT will
remain installed across an upgrade and will only be removed if XENBUS
started but has no bound devices (i.e. it has actually been un-installed).

NOTE: This also fixes an unitialized pointer in FiltersUninstallClass().

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

diff --git a/src/xenbus/driver.c b/src/xenbus/driver.c
index 50c7c5e..0ede4ef 100644
--- a/src/xenbus/driver.c
+++ b/src/xenbus/driver.c
@@ -296,9 +296,6 @@ DriverRemoveFunctionDeviceObject(
     RemoveEntryList(&Dx->ListEntry);
     ASSERT3U(Driver.References, !=, 0);
     References = --Driver.References;
-
-    if (References == 1)
-        FiltersUninstall();
 }
 
 //
@@ -773,6 +770,10 @@ DriverEntry(
         goto done;
     }
 
+    // Remove the filters from the registry. They will be re-instated by
+    // the first successful AddDevice.
+    FiltersUninstall();
+
     DriverObject->DriverExtension->AddDevice = DriverAddDevice;
 
     for (Index = 0; Index <= IRP_MJ_MAXIMUM_FUNCTION; Index++) {
diff --git a/src/xenbus/filters.c b/src/xenbus/filters.c
index dfea119..fc2a1d8 100644
--- a/src/xenbus/filters.c
+++ b/src/xenbus/filters.c
@@ -203,7 +203,7 @@ FiltersUninstallClass(
     HANDLE          Key;
     ULONG           Type;
     ULONG           Count;
-    PANSI_STRING    Old;
+    PANSI_STRING    Old = NULL;
     ULONG           Index;
     PANSI_STRING    New;
     NTSTATUS        status;
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.