]> xenbits.xensource.com Git - pvdrivers/win/xenvbd.git/commitdiff
Account for rewinding requests
authorOwen Smith <owen.smith@citrix.com>
Mon, 15 Jun 2015 11:05:19 +0000 (12:05 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 15 Jun 2015 11:17:50 +0000 (12:17 +0100)
When requests are rewound to the fresh queue during resume from suspend,
decrement the Outstanding stat so that an ASSERT is not triggered.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
src/xenvbd/blockring.c
src/xenvbd/blockring.h
src/xenvbd/pdo.c

index d0b960adec43589b285147e7925928d617193187..28f1393da9c4e3ff7bc50f194f26b96e88831d49 100644 (file)
@@ -589,3 +589,24 @@ BlockRingSubmit(
 
     return TRUE;
 }
+
+VOID
+BlockRingAbort(
+    IN  PXENVBD_BLOCKRING           BlockRing,
+    IN  PXENVBD_REQUEST             Request
+    )
+{
+    KIRQL               Irql;
+
+    UNREFERENCED_PARAMETER(Request);
+
+    KeAcquireSpinLock(&BlockRing->Lock, &Irql);
+
+    // Should check Request is present on the ring, but
+    // the shared page(s) may not contain any valid data,
+    // due to suspend/resume
+    ASSERT3U(BlockRing->Outstanding, >, 0);
+    --BlockRing->Outstanding;
+
+    KeReleaseSpinLock(&BlockRing->Lock, Irql);
+}
index 1117d739de50fb565518977e9b7edc4a647d8e3a..4c94b6c0f0a9900e974de1f52bbd051f606adef6 100644 (file)
@@ -94,4 +94,10 @@ BlockRingSubmit(
     IN  PXENVBD_REQUEST             Request
     );
 
+extern VOID
+BlockRingAbort(
+    IN  PXENVBD_BLOCKRING           BlockRing,
+    IN  PXENVBD_REQUEST             Request
+    );
+
 #endif // _XENVBD_BLOCKRING_H
index 76b0112ebedadb00ccc90f483545f7dc0c41f30a..c5ec9b6bf463fa04cd737b5a4763e749d0fcbc3e 100644 (file)
@@ -1714,7 +1714,8 @@ PdoPreResume(
     __in PXENVBD_PDO             Pdo
     )
 {
-    LIST_ENTRY      List;
+    LIST_ENTRY          List;
+    PXENVBD_BLOCKRING   BlockRing = FrontendGetBlockRing(Pdo->Frontend);
     
     InitializeListHead(&List);
 
@@ -1728,6 +1729,7 @@ PdoPreResume(
         Request = CONTAINING_RECORD(Entry, XENVBD_REQUEST, Entry);
         SrbExt = GetSrbExt(Request->Srb);
 
+        BlockRingAbort(BlockRing, Request);
         RequestCleanup(Pdo, Request);
         __LookasideFree(&Pdo->RequestList, Request);