|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Correct return codes during racy destruction (2).
Signed-off-by: Martin Harvey <martin.harvey@xxxxxxxxxx>
---
src/xendisk/driver.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/xendisk/driver.c b/src/xendisk/driver.c
index 4b004c5..c165c90 100644
--- a/src/xendisk/driver.c
+++ b/src/xendisk/driver.c
@@ -170,8 +170,20 @@ Dispatch(
ASSERT3P(Dx->DeviceObject, ==, DeviceObject);
if (Dx->DevicePnpState == Deleted) {
+ PIO_STACK_LOCATION StackLocation = IoGetCurrentIrpStackLocation(Irp);
+ UCHAR MajorFunction = StackLocation->MajorFunction;
+ UCHAR MinorFunction = StackLocation->MinorFunction;
status = STATUS_NO_SUCH_DEVICE;
+ if (MajorFunction == IRP_MJ_PNP) {
+ if ((MinorFunction == IRP_MN_SURPRISE_REMOVAL) ||
+ (MinorFunction == IRP_MN_REMOVE_DEVICE)) {
+ /* FDO and PDO deletions can block after being marked deleted,
but before IoDeleteDevice */
+ status = STATUS_SUCCESS;
+ }
+ ASSERT((MinorFunction != IRP_MN_CANCEL_REMOVE_DEVICE) &&
(MinorFunction != IRP_MN_CANCEL_STOP_DEVICE));
+ }
+
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
goto done;
--
2.25.0.windows.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |