[NTOSKRNL] Drop the iSharedCacheMapLock in favor of the master lock

This commit is contained in:
Pierre Schweitzer 2018-02-09 11:13:53 +01:00
parent 8119e0ad2b
commit 0518444217
No known key found for this signature in database
GPG Key ID: 7545556C3D585B0B

View File

@ -64,11 +64,6 @@ LIST_ENTRY CcDeferredWrites;
KSPIN_LOCK CcDeferredWriteSpinLock; KSPIN_LOCK CcDeferredWriteSpinLock;
LIST_ENTRY CcCleanSharedCacheMapList; LIST_ENTRY CcCleanSharedCacheMapList;
/* Internal vars (ROS):
* - Lock for the CcCleanSharedCacheMapList list
*/
KSPIN_LOCK iSharedCacheMapLock;
#if DBG #if DBG
static void CcRosVacbIncRefCount_(PROS_VACB vacb, const char* file, int line) static void CcRosVacbIncRefCount_(PROS_VACB vacb, const char* file, int line)
{ {
@ -1100,9 +1095,9 @@ CcRosDeleteFileCache (
CcRosInternalFreeVacb(current); CcRosInternalFreeVacb(current);
} }
KeAcquireSpinLock(&iSharedCacheMapLock, &OldIrql); OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
RemoveEntryList(&SharedCacheMap->SharedCacheMapLinks); RemoveEntryList(&SharedCacheMap->SharedCacheMapLinks);
KeReleaseSpinLock(&iSharedCacheMapLock, OldIrql); KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
ExFreeToNPagedLookasideList(&SharedCacheMapLookasideList, SharedCacheMap); ExFreeToNPagedLookasideList(&SharedCacheMapLookasideList, SharedCacheMap);
KeAcquireGuardedMutex(&ViewLock); KeAcquireGuardedMutex(&ViewLock);
@ -1267,9 +1262,9 @@ CcRosInitializeFileCache (
InitializeListHead(&SharedCacheMap->CacheMapVacbListHead); InitializeListHead(&SharedCacheMap->CacheMapVacbListHead);
FileObject->SectionObjectPointer->SharedCacheMap = SharedCacheMap; FileObject->SectionObjectPointer->SharedCacheMap = SharedCacheMap;
KeAcquireSpinLock(&iSharedCacheMapLock, &OldIrql); OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
InsertTailList(&CcCleanSharedCacheMapList, &SharedCacheMap->SharedCacheMapLinks); InsertTailList(&CcCleanSharedCacheMapList, &SharedCacheMap->SharedCacheMapLinks);
KeReleaseSpinLock(&iSharedCacheMapLock, OldIrql); KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
} }
if (FileObject->PrivateCacheMap == NULL) if (FileObject->PrivateCacheMap == NULL)
{ {
@ -1282,9 +1277,9 @@ CcRosInitializeFileCache (
/* If we also allocated the shared cache map for this file, kill it */ /* If we also allocated the shared cache map for this file, kill it */
if (Allocated) if (Allocated)
{ {
KeAcquireSpinLock(&iSharedCacheMapLock, &OldIrql); OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
RemoveEntryList(&SharedCacheMap->SharedCacheMapLinks); RemoveEntryList(&SharedCacheMap->SharedCacheMapLinks);
KeReleaseSpinLock(&iSharedCacheMapLock, OldIrql); KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
FileObject->SectionObjectPointer->SharedCacheMap = NULL; FileObject->SectionObjectPointer->SharedCacheMap = NULL;
ObDereferenceObject(FileObject); ObDereferenceObject(FileObject);
@ -1349,7 +1344,6 @@ CcInitView (
InitializeListHead(&CcDeferredWrites); InitializeListHead(&CcDeferredWrites);
InitializeListHead(&CcCleanSharedCacheMapList); InitializeListHead(&CcCleanSharedCacheMapList);
KeInitializeSpinLock(&CcDeferredWriteSpinLock); KeInitializeSpinLock(&CcDeferredWriteSpinLock);
KeInitializeSpinLock(&iSharedCacheMapLock);
KeInitializeGuardedMutex(&ViewLock); KeInitializeGuardedMutex(&ViewLock);
ExInitializeNPagedLookasideList(&iBcbLookasideList, ExInitializeNPagedLookasideList(&iBcbLookasideList,
NULL, NULL,