[NTOSKRNL] Use interlocked operations for VACB reference counting.

CORE-14480
CORE-14285
This commit is contained in:
Pierre Schweitzer 2018-03-24 19:15:16 +01:00
parent dea9c291ab
commit 14b05e65ff
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
3 changed files with 60 additions and 23 deletions

View file

@ -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)
{