[NTOSKRNL] Allow pinned dirty VACB to be lazy written.
authorPierre Schweitzer <pierre@reactos.org>
Thu, 25 Jan 2018 20:56:19 +0000 (21:56 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Thu, 25 Jan 2018 21:00:20 +0000 (22:00 +0100)
This is an addition to 07e6e9c.
Also, fix a cppcheck warning (so minor!).

CORE-14249

ntoskrnl/cc/view.c

index 6f4457f..e8da9a5 100644 (file)
@@ -250,7 +250,8 @@ CcRosFlushDirtyPages (
         ASSERT(current->Dirty);
 
         /* One reference is added above */
-        if (current->ReferenceCount > 2)
+        if ((current->ReferenceCount > 2 && current->PinCount == 0) ||
+            (current->ReferenceCount > 3 && current->PinCount > 1))
         {
             CcRosReleaseVacbLock(current);
             current->SharedCacheMap->Callbacks->ReleaseFromLazyWrite(
@@ -883,7 +884,7 @@ CcRosCreateVacb (
 #if MI_TRACE_PFNS
     if ((SharedCacheMap->FileObject) && (SharedCacheMap->FileObject->FileName.Buffer))
     {
-        PWCHAR pos = NULL;
+        PWCHAR pos;
         ULONG len = 0;
         pos = wcsrchr(SharedCacheMap->FileObject->FileName.Buffer, '\\');
         if (pos)