mirror of
https://github.com/reactos/reactos.git
synced 2025-05-20 17:45:06 +00:00
Lock the MainResource from fcb, if we are trying to write back a modified cache segment.
Usually we have to call the callback function from FSD. svn path=/trunk/; revision=19691
This commit is contained in:
parent
0c068e7775
commit
30321765c2
1 changed files with 14 additions and 1 deletions
|
@ -244,21 +244,34 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count)
|
|||
current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT,
|
||||
DirtySegmentListEntry);
|
||||
current_entry = current_entry->Flink;
|
||||
|
||||
// Locked = current->Bcb->Callbacks.AcquireForLazyWrite(current->Bcb->Context, FALSE);
|
||||
Locked = ExTryToAcquireResourceExclusiveLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
|
||||
if (!Locked)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Locked = CcTryToAcquireBrokenMutex(¤t->Lock);
|
||||
if (!Locked)
|
||||
{
|
||||
// current->Bcb->Callbacks.ReleaseFromLazyWrite(current->Bcb->Context);
|
||||
ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
|
||||
continue;
|
||||
}
|
||||
ASSERT(current->Dirty);
|
||||
if (current->ReferenceCount > 1)
|
||||
{
|
||||
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(¤t->Lock);
|
||||
// current->Bcb->Callbacks.ReleaseFromLazyWrite(current->Bcb->Context);
|
||||
ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
|
||||
continue;
|
||||
}
|
||||
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&ViewLock);
|
||||
PagesPerSegment = current->Bcb->CacheSegmentSize / PAGE_SIZE;
|
||||
Status = CcRosFlushCacheSegment(current);
|
||||
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(¤t->Lock);
|
||||
// current->Bcb->Callbacks.ReleaseFromLazyWrite(current->Bcb->Context);
|
||||
ExReleaseResourceLite(((FSRTL_COMMON_FCB_HEADER*)(current->Bcb->FileObject->FsContext))->Resource);
|
||||
if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE))
|
||||
{
|
||||
DPRINT1("CC: Failed to flush cache segment.\n");
|
||||
|
@ -443,7 +456,7 @@ CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset)
|
|||
if (current->FileOffset <= FileOffset &&
|
||||
(current->FileOffset + Bcb->CacheSegmentSize) > FileOffset)
|
||||
{
|
||||
CcRosCacheSegmentIncRefCount(current);
|
||||
CcRosCacheSegmentIncRefCount(current);
|
||||
KeReleaseSpinLock(&Bcb->BcbLock, oldIrql);
|
||||
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(¤t->Lock);
|
||||
return(current);
|
||||
|
|
Loading…
Reference in a new issue