Author: cgutman Date: Mon Dec 19 08:22:16 2011 New Revision: 54692
URL: http://svn.reactos.org/svn/reactos?rev=54692&view=rev Log: [NTOSKRNL] - Always use push locks within a critical region
Modified: trunk/reactos/ntoskrnl/cc/pin.c trunk/reactos/ntoskrnl/cc/view.c
Modified: trunk/reactos/ntoskrnl/cc/pin.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/pin.c?rev=54692... ============================================================================== --- trunk/reactos/ntoskrnl/cc/pin.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cc/pin.c [iso-8859-1] Mon Dec 19 08:22:16 2011 @@ -240,6 +240,7 @@ IoStatus->Information = 0; if (WriteThrough) { + KeEnterCriticalRegion(); ExAcquirePushLockExclusive(&iBcb->CacheSegment->Lock); if (iBcb->CacheSegment->Dirty) { @@ -250,6 +251,7 @@ IoStatus->Status = STATUS_SUCCESS; } ExReleasePushLockExclusive(&iBcb->CacheSegment->Lock); + KeLeaveCriticalRegion(); } else {
Modified: trunk/reactos/ntoskrnl/cc/view.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/view.c?rev=5469... ============================================================================== --- trunk/reactos/ntoskrnl/cc/view.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cc/view.c [iso-8859-1] Mon Dec 19 08:22:16 2011 @@ -448,6 +448,7 @@ KeReleaseSpinLock(&Bcb->BcbLock, oldIrql); KeReleaseGuardedMutex(&ViewLock); ExReleasePushLock(&CacheSeg->Lock); + KeLeaveCriticalRegion();
return(STATUS_SUCCESS); } @@ -476,6 +477,7 @@ { CcRosCacheSegmentIncRefCount(current); KeReleaseSpinLock(&Bcb->BcbLock, oldIrql); + KeEnterCriticalRegion(); ExAcquirePushLockExclusive(¤t->Lock); return(current); } @@ -525,6 +527,7 @@
CacheSeg->Dirty = TRUE; ExReleasePushLock(&CacheSeg->Lock); + KeLeaveCriticalRegion();
return(STATUS_SUCCESS); } @@ -574,6 +577,8 @@ KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
ExReleasePushLock(&CacheSeg->Lock); + KeLeaveCriticalRegion(); + return(STATUS_SUCCESS); }
@@ -621,6 +626,7 @@ current->DirtySegmentListEntry.Blink = NULL; current->ReferenceCount = 1; ExInitializePushLock(¤t->Lock); + KeEnterCriticalRegion(); ExAcquirePushLockExclusive(¤t->Lock); KeAcquireGuardedMutex(&ViewLock);
@@ -655,7 +661,8 @@ KeReleaseGuardedMutex(&ViewLock); ExFreeToNPagedLookasideList(&CacheSegLookasideList, *CacheSeg); *CacheSeg = current; - ExAcquirePushLockExclusive(¤t->Lock); + /* We're still in the critical region from above */ + ExAcquirePushLockExclusive(¤t->Lock); return STATUS_SUCCESS; } if (current->FileOffset < FileOffset) @@ -1040,8 +1047,9 @@ IoStatus->Status = Status; } } + ExReleasePushLock(¤t->Lock); + KeLeaveCriticalRegion(); KeAcquireSpinLock(&Bcb->BcbLock, &oldIrql); - ExReleasePushLock(¤t->Lock); CcRosCacheSegmentDecRefCount(current); KeReleaseSpinLock(&Bcb->BcbLock, oldIrql); }