]> xenbits.xensource.com Git - pvdrivers/win/xenvbd.git/commitdiff
Rate limit BLKIF_OP failure log messages
authorDaniel Davis <Daniel.Davis@citrix.com>
Fri, 19 Jul 2019 09:10:31 +0000 (10:10 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Fri, 19 Jul 2019 09:11:16 +0000 (10:11 +0100)
Signed-off-by: Daniel Davis <Daniel.Davis@citrix.com>
src/xenvbd/ring.c

index 93fd920a136833e9d1eaa8e071b35e849c58311c..0dfba7f0e0194842118242b0f64b5ce1ec196507 100644 (file)
@@ -94,6 +94,7 @@ typedef struct _XENVBD_BLKIF_RING {
     ULONG                           RequestsPushed;
     ULONG                           ResponsesProcessed;
     PXENBUS_DEBUG_CALLBACK          DebugCallback;
+    LARGE_INTEGER                   TimeOfLastErrorLog;
 } XENVBD_BLKIF_RING, *PXENVBD_BLKIF_RING;
 
 typedef enum _XENVBD_STAT {
@@ -1212,13 +1213,22 @@ __BlkifRingCompleteResponse(
         break;
 
     case BLKIF_RSP_ERROR:
-    default:
-        Warning("Target[%u][%u] : %s BLKIF_RSP_ERROR\n",
-                FrontendGetTargetId(Frontend),
-                BlkifRing->Index,
-                __BlkifOperationName(Request->Operation));
+    default: {
+        LARGE_INTEGER TimeNow;
+
+        KeQuerySystemTime(&TimeNow);
+
+        // If last log message was more than 10 seconds ago
+        if (TimeNow.QuadPart - BlkifRing->TimeOfLastErrorLog.QuadPart > 100000000ull) {
+            Warning("Target[%u][%u] : %s BLKIF_RSP_ERROR\n",
+                    FrontendGetTargetId(Frontend),
+                    BlkifRing->Index,
+                    __BlkifOperationName(Request->Operation));
+            KeQuerySystemTime(&BlkifRing->TimeOfLastErrorLog);
+        }
         Srb->SrbStatus = SRB_STATUS_ERROR;
         break;
+        }
     }
 
     BlkifRingPutRequest(BlkifRing, Request);