Author: tfaber
Date: Mon Apr 17 18:37:12 2017
New Revision: 74358
URL:
http://svn.reactos.org/svn/reactos?rev=74358&view=rev
Log:
[NTOS:CC]
- Respect the TruncateSize parameter in CcUninitializeCacheMap. Avoids "freeing dirty
VACB" messages for cache views beyond the end of the file.
CORE-12893 #resolve
Modified:
trunk/reactos/ntoskrnl/cc/fs.c
Modified: trunk/reactos/ntoskrnl/cc/fs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/fs.c?rev=74358…
==============================================================================
--- trunk/reactos/ntoskrnl/cc/fs.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cc/fs.c [iso-8859-1] Mon Apr 17 18:37:12 2017
@@ -286,13 +286,34 @@
IN PCACHE_UNINITIALIZE_EVENT UninitializeCompleteEvent OPTIONAL)
{
NTSTATUS Status;
+ PROS_SHARED_CACHE_MAP SharedCacheMap;
+ KIRQL OldIrql;
CCTRACE(CC_API_DEBUG, "FileObject=%p TruncateSize=%p
UninitializeCompleteEvent=%p\n",
FileObject, TruncateSize, UninitializeCompleteEvent);
+ if (TruncateSize != NULL &&
+ FileObject->SectionObjectPointer != NULL &&
+ FileObject->SectionObjectPointer->SharedCacheMap != NULL)
+ {
+ SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
+ KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &OldIrql);
+ if (SharedCacheMap->FileSize.QuadPart > TruncateSize->QuadPart)
+ {
+ SharedCacheMap->FileSize = *TruncateSize;
+ }
+ KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, OldIrql);
+ CcPurgeCacheSection(FileObject->SectionObjectPointer,
+ TruncateSize,
+ 0,
+ FALSE);
+ }
+
Status = CcRosReleaseFileCache(FileObject);
if (UninitializeCompleteEvent)
+ {
KeSetEvent(&UninitializeCompleteEvent->Event, IO_NO_INCREMENT, FALSE);
+ }
return NT_SUCCESS(Status);
}