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

[win-pv-devel] [PATCH] Account for rewinding requests



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@xxxxxxxxxx>
---
 src/xenvbd/blockring.c | 21 +++++++++++++++++++++
 src/xenvbd/blockring.h |  6 ++++++
 src/xenvbd/pdo.c       |  4 +++-
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/xenvbd/blockring.c b/src/xenvbd/blockring.c
index d0b960a..28f1393 100644
--- a/src/xenvbd/blockring.c
+++ b/src/xenvbd/blockring.c
@@ -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);
+}
diff --git a/src/xenvbd/blockring.h b/src/xenvbd/blockring.h
index 1117d73..4c94b6c 100644
--- a/src/xenvbd/blockring.h
+++ b/src/xenvbd/blockring.h
@@ -94,4 +94,10 @@ BlockRingSubmit(
     IN  PXENVBD_REQUEST             Request
     );
 
+extern VOID
+BlockRingAbort(
+    IN  PXENVBD_BLOCKRING           BlockRing,
+    IN  PXENVBD_REQUEST             Request
+    );
+
 #endif // _XENVBD_BLOCKRING_H
diff --git a/src/xenvbd/pdo.c b/src/xenvbd/pdo.c
index 76b0112..c5ec9b6 100644
--- a/src/xenvbd/pdo.c
+++ b/src/xenvbd/pdo.c
@@ -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);
 
-- 
1.9.4.msysgit.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

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