https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c74cbf0c0bed7ae9831c2…
commit c74cbf0c0bed7ae9831c23527931907de55379cc
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Wed Dec 2 12:30:48 2020 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Feb 3 09:41:22 2021 +0100
[NTOS/CC] Be more precise when notifying Mm about dirty pages
---
ntoskrnl/cc/copy.c | 10 ++++++++++
ntoskrnl/cc/pin.c | 5 +++++
ntoskrnl/cc/view.c | 3 ---
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c
index 17b7a366d17..f92040aa0b2 100644
--- a/ntoskrnl/cc/copy.c
+++ b/ntoskrnl/cc/copy.c
@@ -586,6 +586,11 @@ CcCopyWrite (
Buffer = (PVOID)((ULONG_PTR)Buffer + VacbLength);
CurrentOffset += VacbLength;
Length -= VacbLength;
+
+ /* Tell Mm */
+ Status = MmMakePagesDirty(NULL, Add2Ptr(Vacb->BaseAddress, VacbOffset),
VacbLength);
+ if (!NT_SUCCESS(Status))
+ ExRaiseStatus(Status);
}
_SEH2_FINALLY
{
@@ -829,6 +834,11 @@ CcZeroData (
WriteOffset.QuadPart += VacbLength;
Length -= VacbLength;
+
+ /* Tell Mm */
+ Status = MmMakePagesDirty(NULL, Add2Ptr(Vacb->BaseAddress, VacbOffset),
VacbLength);
+ if (!NT_SUCCESS(Status))
+ ExRaiseStatus(Status);
}
_SEH2_FINALLY
{
diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c
index 189ba480305..0d5642b9932 100644
--- a/ntoskrnl/cc/pin.c
+++ b/ntoskrnl/cc/pin.c
@@ -540,6 +540,11 @@ CcSetDirtyPinnedData (
CCTRACE(CC_API_DEBUG, "Bcb=%p Lsn=%p\n",
Bcb, Lsn);
+ /* Tell Mm */
+ MmMakePagesDirty(NULL,
+ Add2Ptr(iBcb->Vacb->BaseAddress,
iBcb->PFCB.MappedFileOffset.QuadPart - iBcb->Vacb->FileOffset.QuadPart),
+ iBcb->PFCB.MappedLength);
+
if (!iBcb->Vacb->Dirty)
{
CcRosMarkDirtyVacb(iBcb->Vacb);
diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c
index a14635f2135..0e07eb7f1b6 100644
--- a/ntoskrnl/cc/view.c
+++ b/ntoskrnl/cc/view.c
@@ -420,9 +420,6 @@ CcRosMarkDirtyVacb (
CcScheduleLazyWriteScan(FALSE);
}
KeReleaseQueuedSpinLock(LockQueueMasterLock, oldIrql);
-
- /* Tell Mm */
- MmMakePagesDirty(NULL, Vacb->BaseAddress, Length);
}
VOID