[FASTFAT]
authorPierre Schweitzer <pierre@reactos.org>
Tue, 19 Sep 2017 21:19:55 +0000 (21:19 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Tue, 19 Sep 2017 21:19:55 +0000 (21:19 +0000)
Only perform dismount check on close/cleanup for volume opening.
This prevents random dismounts and fixes 1st stage when ENABLE_SWAPOUT is enabled in FastFAT (disabled by default).

CORE-13805

svn path=/trunk/; revision=75908

reactos/drivers/filesystems/fastfat/cleanup.c
reactos/drivers/filesystems/fastfat/close.c

index 07e2eb5..85b4ea2 100644 (file)
@@ -25,6 +25,7 @@ VfatCleanupFile(
 {
     PVFATFCB pFcb;
     PVFATCCB pCcb;
+    BOOLEAN IsVolume;
     PDEVICE_EXTENSION DeviceExt = IrpContext->DeviceExt;
     PFILE_OBJECT FileObject = IrpContext->FileObject;
 
@@ -36,7 +37,8 @@ VfatCleanupFile(
     if (!pFcb)
         return STATUS_SUCCESS;
 
-    if (BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME))
+    IsVolume = BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME);
+    if (IsVolume)
     {
         pFcb->OpenHandleCount--;
 
@@ -145,7 +147,7 @@ VfatCleanupFile(
     }
 
 #ifdef ENABLE_SWAPOUT
-    if (BooleanFlagOn(DeviceExt->Flags, VCB_DISMOUNT_PENDING))
+    if (IsVolume && BooleanFlagOn(DeviceExt->Flags, VCB_DISMOUNT_PENDING))
     {
         VfatCheckForDismount(DeviceExt, FALSE);
     }
index 10d40bd..b4e5fda 100644 (file)
@@ -25,6 +25,7 @@ VfatCloseFile(
 {
     PVFATFCB pFcb;
     PVFATCCB pCcb;
+    BOOLEAN IsVolume;
     NTSTATUS Status = STATUS_SUCCESS;
 
     DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n",
@@ -39,7 +40,8 @@ VfatCloseFile(
         return STATUS_SUCCESS;
     }
 
-    if (BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME))
+    IsVolume = BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME);
+    if (IsVolume)
     {
         DPRINT("Volume\n");
         FileObject->FsContext2 = NULL;
@@ -59,7 +61,7 @@ VfatCloseFile(
     }
 
 #ifdef ENABLE_SWAPOUT
-    if (DeviceExt->OpenHandleCount == 0)
+    if (IsVolume && DeviceExt->OpenHandleCount == 0)
     {
         VfatCheckForDismount(DeviceExt, FALSE);
     }