[NTOS:CC] Do not write behind concurrently the same file

This commit is contained in:
Jérôme Gardou 2020-12-22 11:31:51 +01:00
parent 347a4f146b
commit 1505abbc09
2 changed files with 13 additions and 0 deletions

View file

@ -262,6 +262,15 @@ CcRosFlushDirtyPages (
ASSERT(current->Dirty);
/* Do not lazy-write the same file concurrently. Fastfat ASSERTS on that */
if (current->SharedCacheMap->Flags & SHARED_CACHE_MAP_IN_LAZYWRITE)
{
CcRosVacbDecRefCount(current);
continue;
}
current->SharedCacheMap->Flags |= SHARED_CACHE_MAP_IN_LAZYWRITE;
KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
Locked = current->SharedCacheMap->Callbacks->AcquireForLazyWrite(
@ -272,6 +281,7 @@ CcRosFlushDirtyPages (
ASSERT(!Wait);
OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
CcRosVacbDecRefCount(current);
current->SharedCacheMap->Flags &= ~SHARED_CACHE_MAP_IN_LAZYWRITE;
continue;
}
@ -287,6 +297,8 @@ CcRosFlushDirtyPages (
CcRosVacbDecRefCount(current);
OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
current->SharedCacheMap->Flags &= ~SHARED_CACHE_MAP_IN_LAZYWRITE;
if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE) &&
(Status != STATUS_MEDIA_WRITE_PROTECTED))
{

View file

@ -200,6 +200,7 @@ typedef struct _ROS_SHARED_CACHE_MAP
#define READAHEAD_DISABLED 0x1
#define WRITEBEHIND_DISABLED 0x2
#define SHARED_CACHE_MAP_IN_CREATION 0x4
#define SHARED_CACHE_MAP_IN_LAZYWRITE 0x8
typedef struct _ROS_VACB
{