mirror of
https://github.com/reactos/reactos.git
synced 2026-06-06 13:47:40 +08:00
[NTOSKRNL] Map the VACB in kernel space before inserting it in lists.
The avoids race conditions where attempts to read from disk to not fully initialized VACB were performed. Also, added more debug prints in such situations. CORE-14349
This commit is contained in:
@@ -110,6 +110,7 @@ CcReadVirtualAddress (
|
||||
_SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
DPRINT1("MmProbeAndLockPages failed with: %lx for %p (%p, %p)\n", Status, Mdl, Vacb, Vacb->BaseAddress);
|
||||
KeBugCheck(CACHE_MANAGER);
|
||||
} _SEH2_END;
|
||||
|
||||
@@ -186,6 +187,7 @@ CcWriteVirtualAddress (
|
||||
_SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
DPRINT1("MmProbeAndLockPages failed with: %lx for %p (%p, %p)\n", Status, Mdl, Vacb, Vacb->BaseAddress);
|
||||
KeBugCheck(CACHE_MANAGER);
|
||||
} _SEH2_END;
|
||||
|
||||
|
||||
@@ -752,6 +752,17 @@ CcRosCreateVacb (
|
||||
InitializeListHead(¤t->CacheMapVacbListEntry);
|
||||
InitializeListHead(¤t->DirtyVacbListEntry);
|
||||
InitializeListHead(¤t->VacbLruListEntry);
|
||||
|
||||
CcRosVacbIncRefCount(current);
|
||||
|
||||
Status = CcRosMapVacbInKernelSpace(current);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
CcRosVacbDecRefCount(current);
|
||||
ExFreeToNPagedLookasideList(&VacbLookasideList, current);
|
||||
return Status;
|
||||
}
|
||||
|
||||
CcRosAcquireVacbLock(current, NULL);
|
||||
KeAcquireGuardedMutex(&ViewLock);
|
||||
|
||||
@@ -784,9 +795,10 @@ CcRosCreateVacb (
|
||||
current);
|
||||
}
|
||||
#endif
|
||||
CcRosVacbDecRefCount(*Vacb);
|
||||
CcRosReleaseVacbLock(*Vacb);
|
||||
KeReleaseGuardedMutex(&ViewLock);
|
||||
ExFreeToNPagedLookasideList(&VacbLookasideList, *Vacb);
|
||||
CcRosInternalFreeVacb(*Vacb);
|
||||
*Vacb = current;
|
||||
CcRosAcquireVacbLock(current, NULL);
|
||||
return STATUS_SUCCESS;
|
||||
@@ -813,7 +825,6 @@ CcRosCreateVacb (
|
||||
}
|
||||
KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, oldIrql);
|
||||
InsertTailList(&VacbLruListHead, ¤t->VacbLruListEntry);
|
||||
CcRosVacbIncRefCount(current);
|
||||
KeReleaseGuardedMutex(&ViewLock);
|
||||
|
||||
MI_SET_USAGE(MI_USAGE_CACHE);
|
||||
@@ -838,17 +849,6 @@ CcRosCreateVacb (
|
||||
/* Reference it to allow release */
|
||||
CcRosVacbIncRefCount(current);
|
||||
|
||||
Status = CcRosMapVacbInKernelSpace(current);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RemoveEntryList(¤t->CacheMapVacbListEntry);
|
||||
RemoveEntryList(¤t->VacbLruListEntry);
|
||||
CcRosReleaseVacb(SharedCacheMap, current, FALSE,
|
||||
FALSE, FALSE);
|
||||
CcRosVacbDecRefCount(current);
|
||||
ExFreeToNPagedLookasideList(&VacbLookasideList, current);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user