https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bd709879097ca09224a4c1d6680cec3e7f5a4598

commit bd709879097ca09224a4c1d6680cec3e7f5a4598
Author:     Pierre Schweitzer <[email protected]>
AuthorDate: Sat Feb 10 23:49:33 2018 +0100
Commit:     Pierre Schweitzer <[email protected]>
CommitDate: Sat Feb 10 23:50:26 2018 +0100

    [NTOSKRNL] In debug builds, print more information about the top level IRP 
in the Cc worker thread
    
    CORE-14315
---
 ntoskrnl/cc/lazywrite.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/ntoskrnl/cc/lazywrite.c b/ntoskrnl/cc/lazywrite.c
index adb9fb09d7..ddb7bc42c3 100644
--- a/ntoskrnl/cc/lazywrite.c
+++ b/ntoskrnl/cc/lazywrite.c
@@ -204,12 +204,26 @@ CcWorkerThread(
     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;
 
+#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)
     {
@@ -288,6 +302,14 @@ CcWorkerThread(
     /* 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
 }
 
 /*

Reply via email to