commit c6cee514bba39ecf5fe3e5090c297ac4d6c05139
Author: Murtaza Ghiya <murtazg@xxxxxxxxxx>
Date: Thu Jun 4 13:03:36 2015 -0700
Fixing the incorrect device relations
diff --git a/src/xendisk/fdo.c b/src/xendisk/fdo.c
index 154400f..38cd4f9 100644
--- a/src/xendisk/fdo.c
+++ b/src/xendisk/fdo.c
@@ -883,7 +883,15 @@ FdoQueryDeviceRelations(
for (ListEntry = Fdo->Dx->ListEntry.Flink;
ListEntry != &Fdo->Dx->ListEntry;
ListEntry = ListEntry->Flink)
+ {
+ PXENDISK_DX Dx = CONTAINING_RECORD(ListEntry, XENDISK_DX, ListEntry);
+ PXENDISK_PDO Pdo = Dx->Pdo;
+
+ if (PdoGetDevicePnpState(Pdo) == Enumerated && PdoIsMissing(Pdo))
+ continue;
+
Count++;
+ }
Size = FIELD_OFFSET(DEVICE_RELATIONS, Objects) + (sizeof (DEVICE_OBJECT) * __min(Count, 1));
@@ -903,6 +911,9 @@ FdoQueryDeviceRelations(
ASSERT3U(Dx->Type, ==, PHYSICAL_DEVICE_OBJECT);
+ if (PdoGetDevicePnpState(Pdo) == Enumerated && PdoIsMissing(Pdo))
+ continue;
+
if (PdoGetDevicePnpState(Pdo) == Present)
PdoSetDevicePnpState(Pdo, Enumerated);
diff --git a/src/xendisk/pdo.c b/src/xendisk/pdo.c
index fe11e18..e90e903 100644
--- a/src/xendisk/pdo.c
+++ b/src/xendisk/pdo.c
@@ -1138,6 +1138,10 @@ done:
PdoDestroy(Pdo);
FdoReleaseMutex(Fdo);
}
+ else if (__PdoGetDevicePnpState(Pdo) == Enumerated)
+ {
+ __PdoSetMissing(Pdo, "Device removed");
+ }
return status;