https://git.reactos.org/?p=reactos.git;a=commitdiff;h=07e6e9c9c1415385edf7f…
commit 07e6e9c9c1415385edf7fb6ad5f503b88db8b047
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Tue Jan 23 21:48:29 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Tue Jan 23 23:25:26 2018 +0100
[NTOSKRNL] When marking a BCB dirty, also mark the underlying VACB dirty.
Experiment and MSDN tend to show that a dirty BCB is queued for lazy write.
This will do the job here!
Also, renamed CcRosMarkDirtyFile() which is more accurate, and added a new
function CcRosMarkDirtyVacb() which just takes a VACB as arg (expected locked)
and marks it dirty (using previous implementation). Make CcRosMarkDirtyFile()
use it.
CORE-14235
---
ntoskrnl/cc/pin.c | 1 +
ntoskrnl/cc/view.c | 42 ++++++++++++++++++++++++++++--------------
ntoskrnl/include/internal/cc.h | 7 ++++++-
ntoskrnl/mm/section.c | 4 ++--
4 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c
index 0241927f95..393b206a0f 100644
--- a/ntoskrnl/cc/pin.c
+++ b/ntoskrnl/cc/pin.c
@@ -247,6 +247,7 @@ CcSetDirtyPinnedData (
Bcb, Lsn);
iBcb->Dirty = TRUE;
+ CcRosMarkDirtyVacb(iBcb->Vacb);
}
diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c
index 0d1822c696..465fffa595 100644
--- a/ntoskrnl/cc/view.c
+++ b/ntoskrnl/cc/view.c
@@ -565,25 +565,15 @@ CcRosLookupVacb (
return NULL;
}
-NTSTATUS
+VOID
NTAPI
CcRosMarkDirtyVacb (
- PROS_SHARED_CACHE_MAP SharedCacheMap,
- LONGLONG FileOffset)
+ PROS_VACB Vacb)
{
- PROS_VACB Vacb;
KIRQL oldIrql;
+ PROS_SHARED_CACHE_MAP SharedCacheMap;
- ASSERT(SharedCacheMap);
-
- DPRINT("CcRosMarkDirtyVacb(SharedCacheMap 0x%p, FileOffset %I64u)\n",
- SharedCacheMap, FileOffset);
-
- Vacb = CcRosLookupVacb(SharedCacheMap, FileOffset);
- if (Vacb == NULL)
- {
- KeBugCheck(CACHE_MANAGER);
- }
+ SharedCacheMap = Vacb->SharedCacheMap;
KeAcquireGuardedMutex(&ViewLock);
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &oldIrql);
@@ -606,6 +596,30 @@ CcRosMarkDirtyVacb (
KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql);
KeReleaseGuardedMutex(&ViewLock);
+}
+
+NTSTATUS
+NTAPI
+CcRosMarkDirtyFile (
+ PROS_SHARED_CACHE_MAP SharedCacheMap,
+ LONGLONG FileOffset)
+{
+ PROS_VACB Vacb;
+
+ ASSERT(SharedCacheMap);
+
+ DPRINT("CcRosMarkDirtyVacb(SharedCacheMap 0x%p, FileOffset %I64u)\n",
+ SharedCacheMap, FileOffset);
+
+ Vacb = CcRosLookupVacb(SharedCacheMap, FileOffset);
+ if (Vacb == NULL)
+ {
+ KeBugCheck(CACHE_MANAGER);
+ }
+
+ CcRosMarkDirtyVacb(Vacb);
+
+
CcRosReleaseVacbLock(Vacb);
return STATUS_SUCCESS;
diff --git a/ntoskrnl/include/internal/cc.h b/ntoskrnl/include/internal/cc.h
index b1bb1ab165..cc62381aad 100644
--- a/ntoskrnl/include/internal/cc.h
+++ b/ntoskrnl/include/internal/cc.h
@@ -281,11 +281,16 @@ CcInitCacheZeroPage(VOID);
NTSTATUS
NTAPI
-CcRosMarkDirtyVacb(
+CcRosMarkDirtyFile(
PROS_SHARED_CACHE_MAP SharedCacheMap,
LONGLONG FileOffset
);
+VOID
+NTAPI
+CcRosMarkDirtyVacb(
+ PROS_VACB Vacb);
+
NTSTATUS
NTAPI
CcRosFlushDirtyPages(
diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index 66fa6d2245..5c954395a9 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -2374,7 +2374,7 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
ASSERT(SwapEntry == 0);
//SOffset.QuadPart = Offset.QuadPart + Segment->Image.FileOffset;
#ifndef NEWCC
- CcRosMarkDirtyVacb(SharedCacheMap, Offset.QuadPart);
+ CcRosMarkDirtyFile(SharedCacheMap, Offset.QuadPart);
#endif
MmLockSectionSegment(Segment);
MmSetPageEntrySectionSegment(Segment, &Offset, PageEntry);
@@ -4006,7 +4006,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID
Address,
#ifndef NEWCC
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
- CcRosMarkDirtyVacb(SharedCacheMap, Offset.QuadPart +
Segment->Image.FileOffset);
+ CcRosMarkDirtyFile(SharedCacheMap, Offset.QuadPart +
Segment->Image.FileOffset);
#endif
ASSERT(SwapEntry == 0);
}