[FASTFAT]

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
This commit is contained in:
Pierre Schweitzer 2017-09-19 21:19:55 +00:00
parent 67b277f50f
commit 0fa3874c25
2 changed files with 8 additions and 4 deletions

View file

@ -25,6 +25,7 @@ VfatCleanupFile(
{ {
PVFATFCB pFcb; PVFATFCB pFcb;
PVFATCCB pCcb; PVFATCCB pCcb;
BOOLEAN IsVolume;
PDEVICE_EXTENSION DeviceExt = IrpContext->DeviceExt; PDEVICE_EXTENSION DeviceExt = IrpContext->DeviceExt;
PFILE_OBJECT FileObject = IrpContext->FileObject; PFILE_OBJECT FileObject = IrpContext->FileObject;
@ -36,7 +37,8 @@ VfatCleanupFile(
if (!pFcb) if (!pFcb)
return STATUS_SUCCESS; return STATUS_SUCCESS;
if (BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME)) IsVolume = BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME);
if (IsVolume)
{ {
pFcb->OpenHandleCount--; pFcb->OpenHandleCount--;
@ -145,7 +147,7 @@ VfatCleanupFile(
} }
#ifdef ENABLE_SWAPOUT #ifdef ENABLE_SWAPOUT
if (BooleanFlagOn(DeviceExt->Flags, VCB_DISMOUNT_PENDING)) if (IsVolume && BooleanFlagOn(DeviceExt->Flags, VCB_DISMOUNT_PENDING))
{ {
VfatCheckForDismount(DeviceExt, FALSE); VfatCheckForDismount(DeviceExt, FALSE);
} }

View file

@ -25,6 +25,7 @@ VfatCloseFile(
{ {
PVFATFCB pFcb; PVFATFCB pFcb;
PVFATCCB pCcb; PVFATCCB pCcb;
BOOLEAN IsVolume;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n", DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n",
@ -39,7 +40,8 @@ VfatCloseFile(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
if (BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME)) IsVolume = BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME);
if (IsVolume)
{ {
DPRINT("Volume\n"); DPRINT("Volume\n");
FileObject->FsContext2 = NULL; FileObject->FsContext2 = NULL;
@ -59,7 +61,7 @@ VfatCloseFile(
} }
#ifdef ENABLE_SWAPOUT #ifdef ENABLE_SWAPOUT
if (DeviceExt->OpenHandleCount == 0) if (IsVolume && DeviceExt->OpenHandleCount == 0)
{ {
VfatCheckForDismount(DeviceExt, FALSE); VfatCheckForDismount(DeviceExt, FALSE);
} }