[FASTFAT] Uninit directory cache on last handle close.
authorPierre Schweitzer <pierre@reactos.org>
Fri, 18 May 2018 12:51:24 +0000 (14:51 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 18 May 2018 12:51:24 +0000 (14:51 +0200)
CORE-14629
CORE-14557

drivers/filesystems/fastfat/close.c
drivers/filesystems/fastfat/dirwr.c

index 992ccac..bb5cfaa 100644 (file)
@@ -48,6 +48,19 @@ VfatCloseFile(
     }
     else
     {
+        if (pFcb->OpenHandleCount == 0 && BooleanFlagOn(pFcb->Flags, FCB_CACHE_INITIALIZED))
+        {
+            PFILE_OBJECT tmpFileObject;
+            tmpFileObject = pFcb->FileObject;
+            if (tmpFileObject != NULL)
+            {
+                pFcb->FileObject = NULL;
+                CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
+                ClearFlag(pFcb->Flags, FCB_CACHE_INITIALIZED);
+                ObDereferenceObject(tmpFileObject);
+            }
+        }
+
 #ifdef KDBG
         pFcb->Flags |= FCB_CLOSED;
 #endif
index e2026b8..dc073f9 100644 (file)
@@ -37,6 +37,7 @@ vfatFCBInitializeCacheFromVolume(
     }
 
     ASSERT(vfatFCBIsDirectory(fcb));
+    ASSERT(fcb->FileObject == NULL);
 
     Acquired = FALSE;
     if (!ExIsResourceAcquiredExclusive(&vcb->DirResource))