|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH RESEND] xenfilt: Complete enumeration for empty BusRelations
A successful BusRelations query may return no PDOs if no device is
present on that bus. Skipping FdoEnumerate() in that case leaves the
XenFilt FDO marked as not enumerated, so the filter state never moves
from XENFILT_FILTER_ENABLED to PENDING. On an HVM guest with a PV disk
and a CD-ROM on secondary IDE channel (leaving the primary channel
empty), this blocks XenVbd and the guest fails to boot.
Always call FdoEnumerate() so that tracked PDOs are reconciled and the
FDO is marked enumerated even when the bus is empty.
Signed-off-by: Jiaqing Zhao <Zhao.Jiaqing@xxxxxxx>
---
Cc: Owen Smith <owen.smith@xxxxxxxxxx>
Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
src/xenfilt/fdo.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 04427bf..c8d98c6 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -409,17 +409,20 @@ FdoEnumerate(
NTSTATUS status;
Count = Relations->Count;
- ASSERT(Count != 0);
+ PhysicalDeviceObject = NULL;
+ if (Count != 0) {
+ PhysicalDeviceObject = __FdoAllocate(sizeof (PDEVICE_OBJECT) * Count);
- PhysicalDeviceObject = __FdoAllocate(sizeof (PDEVICE_OBJECT) * Count);
-
- status = STATUS_NO_MEMORY;
- if (PhysicalDeviceObject == NULL)
- goto fail1;
+ status = STATUS_NO_MEMORY;
+ if (PhysicalDeviceObject == NULL)
+ goto fail1;
- RtlCopyMemory(PhysicalDeviceObject,
- Relations->Objects,
- sizeof (PDEVICE_OBJECT) * Count);
+ RtlCopyMemory(PhysicalDeviceObject,
+ Relations->Objects,
+ sizeof (PDEVICE_OBJECT) * Count);
+ } else {
+ Info("%s: Enumerated empty BusRelations\n", __FdoGetName(Fdo));
+ }
// Remove any PDOs that do not appear in the device list
ListEntry = Fdo->List.Flink;
@@ -498,7 +501,8 @@ FdoEnumerate(
__FdoSetEnumerated(Fdo);
- __FdoFree(PhysicalDeviceObject);
+ if (PhysicalDeviceObject != NULL)
+ __FdoFree(PhysicalDeviceObject);
return;
fail1:
@@ -942,10 +946,10 @@ FdoQueryDeviceRelations(
Relations = (PDEVICE_RELATIONS)Irp->IoStatus.Information;
- if (Relations->Count != 0)
- FdoEnumerate(Fdo, Relations);
+ FdoEnumerate(Fdo, Relations);
ExFreePool(Relations);
+ Irp->IoStatus.Information = 0;
State = DriverGetFilterState();
Count = 0;
--
2.53.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |