From d96346dede2589d42a9a74cbc26dd24c5fb44c86 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Thu, 26 Feb 2004 19:29:55 +0000 Subject: [PATCH] - Marked a cache segment as page out in progress to prevent from recursive calls to MmPageOutPhysicalAddress. - This fixes bug #220. svn path=/trunk/; revision=8403 --- reactos/ntoskrnl/cc/view.c | 7 +++++-- reactos/ntoskrnl/include/internal/cc.h | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/cc/view.c b/reactos/ntoskrnl/cc/view.c index c9ba56ff38d..b4fa04963ca 100644 --- a/reactos/ntoskrnl/cc/view.c +++ b/reactos/ntoskrnl/cc/view.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: view.c,v 1.71 2003/12/31 05:33:03 jfilby Exp $ +/* $Id: view.c,v 1.72 2004/02/26 19:29:55 hbirr Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/cc/view.c @@ -270,13 +270,14 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed) } else { - if (last != current && current->MappedCount > 0 && !current->Dirty) + if (last != current && current->MappedCount > 0 && !current->Dirty && !current->PageOut) { ULONG i; NTSTATUS Status; current->ReferenceCount++; last = current; + current->PageOut = TRUE; KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); ExReleaseFastMutex(&ViewLock); for (i = 0; i < current->Bcb->CacheSegmentSize / PAGE_SIZE; i++) @@ -292,6 +293,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed) ExAcquireFastMutex(&ViewLock); KeAcquireSpinLock(¤t->Bcb->BcbLock, &oldIrql); current->ReferenceCount--; + current->PageOut = FALSE; KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); current_entry = ¤t->CacheSegmentLRUListEntry; continue; @@ -505,6 +507,7 @@ CcRosCreateCacheSegment(PBCB Bcb, current = ExAllocateFromNPagedLookasideList(&CacheSegLookasideList); current->Valid = FALSE; current->Dirty = FALSE; + current->PageOut = FALSE; current->FileOffset = ROUND_DOWN(FileOffset, Bcb->CacheSegmentSize); current->Bcb = Bcb; current->MappedCount = 0; diff --git a/reactos/ntoskrnl/include/internal/cc.h b/reactos/ntoskrnl/include/internal/cc.h index 86c1b5252c7..5dc6c3e3d1c 100644 --- a/reactos/ntoskrnl/include/internal/cc.h +++ b/reactos/ntoskrnl/include/internal/cc.h @@ -1,6 +1,6 @@ #ifndef __INCLUDE_INTERNAL_CC_H #define __INCLUDE_INTERNAL_CC_H -/* $Id: cc.h,v 1.18 2003/06/27 21:28:30 hbirr Exp $ */ +/* $Id: cc.h,v 1.19 2004/02/26 19:29:55 hbirr Exp $ */ #include @@ -31,6 +31,8 @@ typedef struct _CACHE_SEGMENT BOOLEAN Valid; /* Are the contents of the cache segment data newer than those on disk. */ BOOLEAN Dirty; + /* Page out in progress */ + BOOLEAN PageOut; ULONG MappedCount; /* Entry in the list of segments for this BCB. */ LIST_ENTRY BcbSegmentListEntry; -- 2.17.1