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

[PATCH] Correct return codes during racy destruction.


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Martin Harvey <Martin.Harvey@xxxxxxxxxx>
  • Date: Tue, 8 Nov 2022 10:47:30 +0000
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Martin Harvey <Martin.Harvey@xxxxxxxxxx>, Martin Harvey <martin.harvey@xxxxxxxxxx>
  • Delivery-date: Tue, 08 Nov 2022 10:48:03 +0000
  • Ironport-data: A9a23:cFcztK8QH2lLTC1OaU7iDrUD2H6TJUtcMsCJ2f8bNWPcYEJGY0x3m 2dKW27SMqyPY2X0f9h1O9+/pxlQ6pfRmNJiTFZtqC88E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKucYHsZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ire7kIx1BjOkGlA5AZnPKgb5Aa2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDkkNq /0UKGsQNCqpmqGJ3LSbE7Ergtw8eZyD0IM34hmMzBncBPciB5vCX7/L9ZlT2zJYasJmRKiEI ZBDMHw2MUqGM0Yn1lQ/UfrSmM+tj2PjcjseqFuPu6cmy2PS0BZwwP7mN9+9ltmiFZsExxzF+ DuuE2LRJwMdOtyxwDu5/CiNhajwlGDGSq4uC+jtnhJtqALKnTFCYPEMbnOkoP/8klD7V99BJ kg8/is1sbN05EGtVsP6XRCzvDiDpBF0ZjZLO7RkskfXkPOSulvHQDhfJtJcVDA4nIxoRDAqj ULTpfn0RgNztp3METWZ7qjB+FteJhMpBWMFYCYFSy4M7N/ivJw/g3rzczpzLEKmpoarQG+tm lhmuAB73uxO1pBTi81X6Hid21qRSo71ohnZD+k9dkas9UtHaYGsfOREAnCLvK8bfO51orRs1 UXoevRyDshUU/lhdwTXGo3h+Y1FAN7UWAAweXY1Q/EcG82FohZOvel4uVmS3ntBPMceYiPOa 0TOow5X75I7FCL0M/AnP9zoU5xwk/iI+THZuhf8N4QmX3SMXFXfoHEGibC4gwgBb3TAYYlgY MzGIK5A/F4RCLh9zSreegvu+eZD+83/rEuNLa3GI+OPiuPPPCPJEe5dajNjrIkRtcu5nekcy P4HX+Pi9vmVeLKWjvX/mWLLEW03EA==
  • Ironport-hdrordr: A9a23:KBFxLKGwhFa7Lk2HpLqE5MeALOsnbusQ8zAXP0AYc3Jom6uj5q STdZUgpHnJYVkqOE3I9ertBEDiewK4yXcW2/hzAV7KZmCP0wHEEGgL1/qE/9SKIUzDH4Bmup uIC5IOauHNMQ==
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

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..9573259 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;
+            }
+            BUG_ON((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




 


Rackspace

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