[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
This commit is contained in:
Pierre Schweitzer 2018-01-23 21:48:29 +01:00
parent 6ba67b8152
commit 07e6e9c9c1
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
4 changed files with 37 additions and 17 deletions

View file

@ -247,6 +247,7 @@ CcSetDirtyPinnedData (
Bcb, Lsn);
iBcb->Dirty = TRUE;
CcRosMarkDirtyVacb(iBcb->Vacb);
}

View file

@ -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;

View file

@ -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(

View file

@ -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);
}