[NTOSKRNL] In debug builds, print more information about the top level IRP in the...
authorPierre Schweitzer <pierre@reactos.org>
Sat, 10 Feb 2018 22:49:33 +0000 (23:49 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 10 Feb 2018 22:50:26 +0000 (23:50 +0100)
CORE-14315

ntoskrnl/cc/lazywrite.c

index adb9fb0..ddb7bc4 100644 (file)
@@ -204,12 +204,26 @@ CcWorkerThread(
     KIRQL OldIrql;
     BOOLEAN DropThrottle;
     PWORK_QUEUE_ITEM Item;
     KIRQL OldIrql;
     BOOLEAN DropThrottle;
     PWORK_QUEUE_ITEM Item;
+#if DBG
+    PIRP TopLevel;
+#endif
 
     /* Get back our thread item */
     Item = Parameter;
     /* And by default, don't touch throttle */
     DropThrottle = FALSE;
 
 
     /* Get back our thread item */
     Item = Parameter;
     /* And by default, don't touch throttle */
     DropThrottle = FALSE;
 
+#if DBG
+    /* Top level IRP should be clean when started
+     * Save it to catch buggy drivers (or bugs!)
+     */
+    TopLevel = IoGetTopLevelIrp();
+    if (TopLevel != NULL)
+    {
+        DPRINT1("(%p) TopLevel IRP for this thread: %p\n", PsGetCurrentThread(), TopLevel);
+    }
+#endif
+
     /* Loop till we have jobs */
     while (TRUE)
     {
     /* Loop till we have jobs */
     while (TRUE)
     {
@@ -288,6 +302,14 @@ CcWorkerThread(
     /* One less worker */
     --CcNumberActiveWorkerThreads;
     KeReleaseQueuedSpinLock(LockQueueWorkQueueLock, OldIrql);
     /* One less worker */
     --CcNumberActiveWorkerThreads;
     KeReleaseQueuedSpinLock(LockQueueWorkQueueLock, OldIrql);
+
+#if DBG
+    /* Top level shouldn't have changed */
+    if (TopLevel != IoGetTopLevelIrp())
+    {
+        DPRINT1("(%p) Mismatching TopLevel: %p, %p\n", PsGetCurrentThread(), TopLevel, IoGetTopLevelIrp());
+    }
+#endif
 }
 
 /*
 }
 
 /*