diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 35d0df31545..e6ac23c2b6e 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -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)) { diff --git a/ntoskrnl/include/internal/cc.h b/ntoskrnl/include/internal/cc.h index 862a759ef7a..65fd3fe6ffa 100644 --- a/ntoskrnl/include/internal/cc.h +++ b/ntoskrnl/include/internal/cc.h @@ -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 {