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

commit 358d06c47ca31d8854c8ba2ffa16ab577f798e82
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Tue Dec 29 10:07:57 2020 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Feb 3 09:41:23 2021 +0100

    [NTOS:CC] Always honor WriteThrough parameter in CcUnpinRepinnedBcb
---
 ntoskrnl/cc/pin.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c
index 597468f6fd7..8a79ee45031 100644
--- a/ntoskrnl/cc/pin.c
+++ b/ntoskrnl/cc/pin.c
@@ -629,29 +629,25 @@ CcUnpinRepinnedBcb (
     SharedCacheMap = iBcb->Vacb->SharedCacheMap;
     IoStatus->Status = STATUS_SUCCESS;
 
+    if (WriteThrough)
+    {
+        
CcFlushCache(iBcb->Vacb->SharedCacheMap->FileObject->SectionObjectPointer,
+                     &iBcb->PFCB.MappedFileOffset,
+                     iBcb->PFCB.MappedLength,
+                     IoStatus);
+    }
+    else
+    {
+        IoStatus->Status = STATUS_SUCCESS;
+        IoStatus->Information = 0;
+    }
+
     KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
     if (--iBcb->RefCount == 0)
     {
         RemoveEntryList(&iBcb->BcbEntry);
         KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
 
-        IoStatus->Information = 0;
-        if (WriteThrough)
-        {
-            if (iBcb->Vacb->Dirty)
-            {
-                IoStatus->Status = CcRosFlushVacb(iBcb->Vacb);
-            }
-            else
-            {
-                IoStatus->Status = STATUS_SUCCESS;
-            }
-        }
-        else
-        {
-            IoStatus->Status = STATUS_SUCCESS;
-        }
-
         if (iBcb->PinCount != 0)
         {
             ExReleaseResourceLite(&iBcb->Lock);

Reply via email to