mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 17:01:53 +00:00
[NTOSKRNL] Use interlocked operations for VACB reference counting.
CORE-14480 CORE-14285
This commit is contained in:
parent
dea9c291ab
commit
14b05e65ff
3 changed files with 60 additions and 23 deletions
|
@ -207,6 +207,8 @@ CcPurgeCacheSection (
|
|||
ListEntry = SharedCacheMap->CacheMapVacbListHead.Flink;
|
||||
while (ListEntry != &SharedCacheMap->CacheMapVacbListHead)
|
||||
{
|
||||
ULONG Refs;
|
||||
|
||||
Vacb = CONTAINING_RECORD(ListEntry, ROS_VACB, CacheMapVacbListEntry);
|
||||
ListEntry = ListEntry->Flink;
|
||||
|
||||
|
@ -225,15 +227,16 @@ CcPurgeCacheSection (
|
|||
/* Still in use, it cannot be purged, fail
|
||||
* Allow one ref: VACB is supposed to be always 1-referenced
|
||||
*/
|
||||
if ((Vacb->ReferenceCount > 1 && !Vacb->Dirty) ||
|
||||
(Vacb->ReferenceCount > 2 && Vacb->Dirty))
|
||||
Refs = CcRosVacbGetRefCount(Vacb);
|
||||
if ((Refs > 1 && !Vacb->Dirty) ||
|
||||
(Refs > 2 && Vacb->Dirty))
|
||||
{
|
||||
Success = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* This VACB is in range, so unlink it and mark for free */
|
||||
ASSERT(Vacb->ReferenceCount == 1 || Vacb->Dirty);
|
||||
ASSERT(Refs == 1 || Vacb->Dirty);
|
||||
RemoveEntryList(&Vacb->VacbLruListEntry);
|
||||
if (Vacb->Dirty)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue