From 6e4f83da700fbfac5450dc9ef667585ddc870bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Tue, 16 Feb 2021 17:17:57 +0100 Subject: [PATCH] [NTOS:CC] Wake up lazy scan after inserting elements in the list. --- ntoskrnl/cc/copy.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c index 30864bc319e..09af125540c 100644 --- a/ntoskrnl/cc/copy.c +++ b/ntoskrnl/cc/copy.c @@ -381,16 +381,6 @@ CcCanIWrite ( return FALSE; } - /* Otherwise, if there are no deferred writes yet, start the lazy writer */ - if (IsListEmpty(&CcDeferredWrites)) - { - KIRQL OldIrql; - - OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock); - CcScheduleLazyWriteScan(TRUE); - KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql); - } - /* Initialize our wait event */ KeInitializeEvent(&WaitEvent, NotificationEvent, FALSE); @@ -418,6 +408,12 @@ CcCanIWrite ( &CcDeferredWriteSpinLock); } + /* Now make sure that the lazy scan writer will be active */ + OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock); + if (!LazyWriter.ScanActive) + CcScheduleLazyWriteScan(TRUE); + KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql); + #if DBG DPRINT1("Actively deferring write for: %p\n", FileObject); DPRINT1("Because:\n");