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

[win-pv-devel] [PATCH 2/4] Fail SRBs if ring is not Enabled


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Mon, 16 Sep 2019 16:17:51 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=owen.smith@xxxxxxxxxx; spf=Pass smtp.mailfrom=owen.smith@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Mon, 16 Sep 2019 15:22:01 +0000
  • Ironport-sdr: BReeLtDcuWOUiW4YTFHCFcZN2PcF+bcI8EEE3ajExAUXRGl+zKEmFm7KvCJfxqzqoowfUKhu7g UJ3m1JFAdSxIcy0QuoAJZuh5aDA1oVn+JLbtYEltDutH/c9rAWJ8IfWXsywwNVfI55dv82+Q3+ ytZHoiQZXnSJLiv+4hXvdv6eGk6AE2RFLF5Qzset+ORfwge31kJXqTVqDPzhVUv1Rp5FuGRIQl ulig/w5zyUiN1u/SxQBzV72HNUPGLBat6/RTXJuoJF+gpeSQHOUdY4ZKe2A6ZQeiOhWqDxWIl+ nng=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Dont queue incomming SRBs if the ring is not able to process requests.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/adapter.c |  6 ++----
 src/xenvbd/ring.c    | 34 +++++++++++++++++++++++++++-------
 src/xenvbd/ring.h    |  2 +-
 src/xenvbd/target.c  |  8 ++++----
 src/xenvbd/target.h  |  4 ++--
 5 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/src/xenvbd/adapter.c b/src/xenvbd/adapter.c
index 79a5a0e..2d8d65f 100644
--- a/src/xenvbd/adapter.c
+++ b/src/xenvbd/adapter.c
@@ -1993,13 +1993,11 @@ AdapterHwStartIo(
         break;
 
     case SRB_FUNCTION_FLUSH:
-        TargetFlush(Target, SrbExt);
-        WasQueued = TRUE;
+        WasQueued = TargetFlush(Target, SrbExt);
         break;
 
     case SRB_FUNCTION_SHUTDOWN:
-        TargetShutdown(Target, SrbExt);
-        WasQueued = TRUE;
+        WasQueued = TargetShutdown(Target, SrbExt);
         break;
 
     default:
diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index 52eaca5..3be7c14 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -2148,7 +2148,7 @@ BlkifRingDisconnect(
     Trace("<==== %u\n", BlkifRing->Index);
 }
 
-static VOID
+static BOOLEAN
 __BlkifRingQueueSrb(
     IN  PXENVBD_BLKIF_RING  BlkifRing,
     IN  PXENVBD_SRBEXT      SrbExt
@@ -2159,6 +2159,9 @@ __BlkifRingQueueSrb(
     ULONG_PTR               LockBit;
     ULONG_PTR               New;
 
+    if (!BlkifRing->Enabled)
+        goto fail1;
+
     ListEntry = &SrbExt->ListEntry;
 
     do {
@@ -2178,17 +2181,36 @@ __BlkifRingQueueSrb(
 
     if (__BlkifRingTryAcquireLock(BlkifRing))
         __BlkifRingReleaseLock(BlkifRing);
+
+    return TRUE;
+
+fail1:
+    Error("fail1\n");
+
+    SrbExt->Srb->SrbStatus = SRB_STATUS_BUSY;
+    return FALSE;
 }
 
-static VOID
+static BOOLEAN
 __BlkifRingQueueShutdown(
     IN  PXENVBD_BLKIF_RING  BlkifRing,
     IN  PXENVBD_SRBEXT      SrbExt
     )
 {
+    if (!BlkifRing->Enabled)
+        goto fail1;
+
     __BlkifRingAcquireLock(BlkifRing);
     InsertTailList(&BlkifRing->ShutdownQueue, &SrbExt->ListEntry);
     __BlkifRingReleaseLock(BlkifRing);
+
+    return TRUE;
+
+fail1:
+    Error("fail1\n");
+
+    SrbExt->Srb->SrbStatus = SRB_STATUS_BUSY;
+    return FALSE;
 }
 
 static DECLSPEC_NOINLINE VOID
@@ -2617,12 +2639,10 @@ RingQueueRequest(
     BlkifRing = __RingGetBlkifRing(Ring, Srb->QueueTag);
     ASSERT(BlkifRing != NULL);
 
-    __BlkifRingQueueSrb(BlkifRing, SrbExt);
-
-    return TRUE;
+    return __BlkifRingQueueSrb(BlkifRing, SrbExt);
 }
 
-VOID
+BOOLEAN
 RingQueueShutdown(
     IN  PXENVBD_RING    Ring,
     IN  PXENVBD_SRBEXT  SrbExt
@@ -2634,5 +2654,5 @@ RingQueueShutdown(
     BlkifRing = __RingGetBlkifRing(Ring, Srb->QueueTag);
     ASSERT(BlkifRing != NULL);
 
-    __BlkifRingQueueShutdown(BlkifRing, SrbExt);
+    return __BlkifRingQueueShutdown(BlkifRing, SrbExt);
 }
diff --git a/src/xenvbd/ring.h b/src/xenvbd/ring.h
index e3309e2..81c2644 100644
--- a/src/xenvbd/ring.h
+++ b/src/xenvbd/ring.h
@@ -80,7 +80,7 @@ RingQueueRequest(
     IN  PXENVBD_SRBEXT  SrbExt
     );
 
-extern VOID
+extern BOOLEAN
 RingQueueShutdown(
     IN  PXENVBD_RING    Ring,
     IN  PXENVBD_SRBEXT  SrbExt
diff --git a/src/xenvbd/target.c b/src/xenvbd/target.c
index 176cbbe..e322949 100644
--- a/src/xenvbd/target.c
+++ b/src/xenvbd/target.c
@@ -973,22 +973,22 @@ TargetReset(
     Verbose("[%u] <=====\n", TargetGetTargetId(Target));
 }
 
-VOID
+BOOLEAN
 TargetFlush(
     IN  PXENVBD_TARGET  Target,
     IN  PXENVBD_SRBEXT  SrbExt
     )
 {
-    RingQueueShutdown(FrontendGetRing(Target->Frontend), SrbExt);
+    return RingQueueShutdown(FrontendGetRing(Target->Frontend), SrbExt);
 }
 
-VOID
+BOOLEAN
 TargetShutdown(
     IN  PXENVBD_TARGET  Target,
     IN  PXENVBD_SRBEXT  SrbExt
     )
 {
-    RingQueueShutdown(FrontendGetRing(Target->Frontend), SrbExt);
+    return RingQueueShutdown(FrontendGetRing(Target->Frontend), SrbExt);
 }
 
 VOID
diff --git a/src/xenvbd/target.h b/src/xenvbd/target.h
index dd360f5..cbd0ba4 100644
--- a/src/xenvbd/target.h
+++ b/src/xenvbd/target.h
@@ -110,13 +110,13 @@ TargetReset(
     IN  PXENVBD_TARGET  Target
     );
 
-extern VOID
+extern BOOLEAN
 TargetFlush(
     IN  PXENVBD_TARGET  Target,
     IN  PXENVBD_SRBEXT  SrbExt
     );
 
-extern VOID
+extern BOOLEAN
 TargetShutdown(
     IN  PXENVBD_TARGET  Target,
     IN  PXENVBD_SRBEXT  SrbExt
-- 
2.16.2.windows.1


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

 


Rackspace

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