mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:12:58 +00:00
[NTOSKRNL] In CcPurgeCacheSection(), don't assume the file being purged isn't used. Handle that case properly instead of asserting.
This fixes a triggerable ASSERT from umode where you open a file on a CDFS (with MS CDFS) and attempt to lock the volume.
This commit is contained in:
parent
4768a371f4
commit
64cb138a67
1 changed files with 11 additions and 3 deletions
|
@ -143,6 +143,7 @@ CcPurgeCacheSection (
|
||||||
PLIST_ENTRY ListEntry;
|
PLIST_ENTRY ListEntry;
|
||||||
PROS_VACB Vacb;
|
PROS_VACB Vacb;
|
||||||
LONGLONG ViewEnd;
|
LONGLONG ViewEnd;
|
||||||
|
BOOLEAN Success;
|
||||||
|
|
||||||
CCTRACE(CC_API_DEBUG, "SectionObjectPointer=%p\n FileOffset=%p Length=%lu UninitializeCacheMaps=%d",
|
CCTRACE(CC_API_DEBUG, "SectionObjectPointer=%p\n FileOffset=%p Length=%lu UninitializeCacheMaps=%d",
|
||||||
SectionObjectPointer, FileOffset, Length, UninitializeCacheMaps);
|
SectionObjectPointer, FileOffset, Length, UninitializeCacheMaps);
|
||||||
|
@ -169,6 +170,9 @@ CcPurgeCacheSection (
|
||||||
|
|
||||||
InitializeListHead(&FreeList);
|
InitializeListHead(&FreeList);
|
||||||
|
|
||||||
|
/* Assume success */
|
||||||
|
Success = TRUE;
|
||||||
|
|
||||||
KeAcquireGuardedMutex(&ViewLock);
|
KeAcquireGuardedMutex(&ViewLock);
|
||||||
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &OldIrql);
|
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &OldIrql);
|
||||||
ListEntry = SharedCacheMap->CacheMapVacbListHead.Flink;
|
ListEntry = SharedCacheMap->CacheMapVacbListHead.Flink;
|
||||||
|
@ -189,8 +193,12 @@ CcPurgeCacheSection (
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT((Vacb->ReferenceCount == 0) ||
|
/* Still in use, it cannot be purged, fail */
|
||||||
(Vacb->ReferenceCount == 1 && Vacb->Dirty));
|
if (Vacb->ReferenceCount != 0 && !Vacb->Dirty)
|
||||||
|
{
|
||||||
|
Success = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* This VACB is in range, so unlink it and mark for free */
|
/* This VACB is in range, so unlink it and mark for free */
|
||||||
RemoveEntryList(&Vacb->VacbLruListEntry);
|
RemoveEntryList(&Vacb->VacbLruListEntry);
|
||||||
|
@ -213,7 +221,7 @@ CcPurgeCacheSection (
|
||||||
CcRosInternalFreeVacb(Vacb);
|
CcRosInternalFreeVacb(Vacb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue