[NTOSKRNL] Don't call AcquireForLazyWrite with the master lock held
authorPierre Schweitzer <pierre@reactos.org>
Fri, 21 Dec 2018 07:44:14 +0000 (08:44 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 21 Dec 2018 07:46:40 +0000 (08:46 +0100)
This incorrect behavior was leading to a call at too high IRQL for paged code.
This was triggered by MS FastFAT.

ReleaseFromLazyWrite call was already correctly called to that regard.

CORE-11819

ntoskrnl/cc/view.c

index 81a1dac..d644965 100644 (file)
@@ -222,18 +222,19 @@ CcRosFlushDirtyPages (
             continue;
         }
 
+        ASSERT(current->Dirty);
+
+        KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
+
         Locked = current->SharedCacheMap->Callbacks->AcquireForLazyWrite(
                      current->SharedCacheMap->LazyWriteContext, Wait);
         if (!Locked)
         {
+            OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
             CcRosVacbDecRefCount(current);
             continue;
         }
 
-        ASSERT(current->Dirty);
-
-        KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
-
         Status = CcRosFlushVacb(current);
 
         current->SharedCacheMap->Callbacks->ReleaseFromLazyWrite(