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

[PATCH] Correct return codes during racy destruction (2).


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Martin Harvey <Martin.Harvey@xxxxxxxxxx>
  • Date: Tue, 8 Nov 2022 11:00:44 +0000
  • Authentication-results: esa6.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 11:01:01 +0000
  • Ironport-data: A9a23:oxIipKCyxi+G/BVW/3Hjw5YqxClBgxIJ4kV8jS/XYbTApGtwgmQHn GAXXTyFbqrYMzageY9+aovi9ksC7cXXyNRkQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nNHuCnYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFtcpvlDs15K6o4WpA7gRnDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw2f1lGkh27 /UkDCkWXzmymcWI3YnjVbw57igjBJGD0II3v3hhyXfSDOo8QICFSKLPjTNa9G5u3IYUR6+YP pdHL2o0BPjDS0Qn1lM/DZskgOauwHn2aSNVuXqepLYt4niVxwt0uFToGIqOK4PWFJQP9qqej n+f5Er+OTxdDvDB6B2n0SOsg+/XoCyuDer+E5Xnr6U30TV/3Fc7FxwQEEOl5PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yENopTZFBYAWSbdjrljQlOyEuG51G1ToUBZic849nfcsTAAOz 0S4tuL3IgJyi+WKHCf1GqivkRu+Pi0cLGknbCACTBcY79SLnLzfni4jXf44Tvfr04Sd9SXYh mnT8XNg3+l7Ydsjjf3TwLzRv967SnElpCYR7x6fYG+q5xgRiGWNN93xsgizARqtwe+kori9U JoswZb2AAMmV8vleMmxrAIlTdmUCw6tamG0vLKWN8BJGvTE0yfLkXpsyD9/Plx1Fc0PZCXkZ kTe0SsIusEMbCf0NPcvOdzhYyjP8UQHPY27Ps04k/IUOsQhHON51H0GibGsM5DFzxF3zPBX1 WazesewF3cKYZmLPxLvL9rwENYDmEgD+I8kbcumkkX6iOLFOCD9pHVsGALmU93VJZis+G39m +uz/ePTo/mDeIUSuhXqzLM=
  • Ironport-hdrordr: A9a23:BR0Iqal4yIZZZVaD59JZ1Pdvhl7pDfIm3DAbv31ZSRFFG/Fxl6 iV88jzsiWE7Qr5OUtQ/uxoV5PgfZqxz/NICOoqTNWftWvd2FdARbsKheCJ/9SJIVybygc378 ldmsZFZOEYdWIK7vrH3A==
  • 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..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




 


Rackspace

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