https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a837694518ded3114e59ab39028b1f92707664c1

commit a837694518ded3114e59ab39028b1f92707664c1
Author:     Pierre Schweitzer <[email protected]>
AuthorDate: Fri May 18 14:51:24 2018 +0200
Commit:     Pierre Schweitzer <[email protected]>
CommitDate: Fri May 18 14:51:24 2018 +0200

    [FASTFAT] Uninit directory cache on last handle close.
    
    CORE-14629
    CORE-14557
---
 drivers/filesystems/fastfat/close.c | 13 +++++++++++++
 drivers/filesystems/fastfat/dirwr.c |  1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/filesystems/fastfat/close.c 
b/drivers/filesystems/fastfat/close.c
index 992ccac4c2..bb5cfaae78 100644
--- a/drivers/filesystems/fastfat/close.c
+++ b/drivers/filesystems/fastfat/close.c
@@ -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
diff --git a/drivers/filesystems/fastfat/dirwr.c 
b/drivers/filesystems/fastfat/dirwr.c
index e2026b8cd9..dc073f9236 100644
--- a/drivers/filesystems/fastfat/dirwr.c
+++ b/drivers/filesystems/fastfat/dirwr.c
@@ -37,6 +37,7 @@ vfatFCBInitializeCacheFromVolume(
     }
 
     ASSERT(vfatFCBIsDirectory(fcb));
+    ASSERT(fcb->FileObject == NULL);
 
     Acquired = FALSE;
     if (!ExIsResourceAcquiredExclusive(&vcb->DirResource))

Reply via email to