mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 05:20:54 +00:00
[NTOSKRNL] When marking a VACB dirty on unmap/unpin, use CcRosMarkDirtyVacb().
This should help reducing race conditions with lazy writer, and thus reduce random BSODs. CORE-14263
This commit is contained in:
parent
1971137a5f
commit
a3d78067ab
1 changed files with 22 additions and 28 deletions
|
@ -517,26 +517,25 @@ CcRosReleaseVacb (
|
|||
BOOLEAN Mapped)
|
||||
{
|
||||
BOOLEAN WasDirty;
|
||||
KIRQL oldIrql;
|
||||
|
||||
ASSERT(SharedCacheMap);
|
||||
|
||||
DPRINT("CcRosReleaseVacb(SharedCacheMap 0x%p, Vacb 0x%p, Valid %u)\n",
|
||||
SharedCacheMap, Vacb, Valid);
|
||||
|
||||
KeAcquireGuardedMutex(&ViewLock);
|
||||
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &oldIrql);
|
||||
|
||||
Vacb->Valid = Valid;
|
||||
|
||||
WasDirty = Vacb->Dirty;
|
||||
Vacb->Dirty = Vacb->Dirty || Dirty;
|
||||
|
||||
if (!WasDirty && Vacb->Dirty)
|
||||
WasDirty = FALSE;
|
||||
if (Dirty)
|
||||
{
|
||||
InsertTailList(&DirtyVacbListHead, &Vacb->DirtyVacbListEntry);
|
||||
CcTotalDirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
Vacb->SharedCacheMap->DirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
if (!Vacb->Dirty && Dirty)
|
||||
{
|
||||
CcRosMarkDirtyVacb(Vacb);
|
||||
}
|
||||
else
|
||||
{
|
||||
WasDirty = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Mapped)
|
||||
|
@ -553,8 +552,6 @@ CcRosReleaseVacb (
|
|||
CcRosVacbIncRefCount(Vacb);
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql);
|
||||
KeReleaseGuardedMutex(&ViewLock);
|
||||
CcRosReleaseVacbLock(Vacb);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -676,7 +673,6 @@ CcRosUnmapVacb (
|
|||
{
|
||||
PROS_VACB Vacb;
|
||||
BOOLEAN WasDirty;
|
||||
KIRQL oldIrql;
|
||||
|
||||
ASSERT(SharedCacheMap);
|
||||
|
||||
|
@ -689,21 +685,21 @@ CcRosUnmapVacb (
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
KeAcquireGuardedMutex(&ViewLock);
|
||||
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &oldIrql);
|
||||
|
||||
WasDirty = Vacb->Dirty;
|
||||
Vacb->Dirty = Vacb->Dirty || NowDirty;
|
||||
WasDirty = FALSE;
|
||||
if (NowDirty)
|
||||
{
|
||||
if (!Vacb->Dirty && NowDirty)
|
||||
{
|
||||
CcRosMarkDirtyVacb(Vacb);
|
||||
}
|
||||
else
|
||||
{
|
||||
WasDirty = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
Vacb->MappedCount--;
|
||||
|
||||
if (!WasDirty && NowDirty)
|
||||
{
|
||||
InsertTailList(&DirtyVacbListHead, &Vacb->DirtyVacbListEntry);
|
||||
CcTotalDirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
Vacb->SharedCacheMap->DirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE;
|
||||
}
|
||||
|
||||
CcRosVacbDecRefCount(Vacb);
|
||||
if (!WasDirty && NowDirty)
|
||||
{
|
||||
|
@ -714,8 +710,6 @@ CcRosUnmapVacb (
|
|||
CcRosVacbDecRefCount(Vacb);
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql);
|
||||
KeReleaseGuardedMutex(&ViewLock);
|
||||
CcRosReleaseVacbLock(Vacb);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
|
Loading…
Reference in a new issue