mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[FASTFAT] Properly handle IRPs that can wait and these that cannot.
CORE-14634
This commit is contained in:
parent
8c5cf73018
commit
b4363068d1
3 changed files with 31 additions and 35 deletions
|
@ -50,17 +50,8 @@ VfatCleanupFile(
|
|||
}
|
||||
else
|
||||
{
|
||||
if(!ExAcquireResourceExclusiveLite(&pFcb->MainResource,
|
||||
BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
|
||||
{
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
if(!ExAcquireResourceExclusiveLite(&pFcb->PagingIoResource,
|
||||
BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
|
||||
{
|
||||
ExReleaseResourceLite(&pFcb->MainResource);
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
ExAcquireResourceExclusiveLite(&pFcb->MainResource, TRUE);
|
||||
ExAcquireResourceExclusiveLite(&pFcb->PagingIoResource, TRUE);
|
||||
|
||||
pCcb = FileObject->FsContext2;
|
||||
if (BooleanFlagOn(pCcb->Flags, CCB_DELETE_ON_CLOSE))
|
||||
|
@ -173,21 +164,10 @@ VfatCleanup(
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource,
|
||||
BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
|
||||
{
|
||||
return VfatMarkIrpContextForQueue(IrpContext);
|
||||
}
|
||||
|
||||
ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, TRUE);
|
||||
Status = VfatCleanupFile(IrpContext);
|
||||
|
||||
ExReleaseResourceLite(&IrpContext->DeviceExt->DirResource);
|
||||
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
return VfatMarkIrpContextForQueue(IrpContext);
|
||||
}
|
||||
|
||||
IrpContext->Irp->IoStatus.Information = 0;
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -1059,11 +1059,6 @@ VfatCreate(
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT))
|
||||
{
|
||||
return VfatMarkIrpContextForQueue(IrpContext);
|
||||
}
|
||||
|
||||
IrpContext->Irp->IoStatus.Information = 0;
|
||||
ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, TRUE);
|
||||
Status = VfatCreateFile(IrpContext->DeviceObject, IrpContext->Irp);
|
||||
|
|
|
@ -287,18 +287,39 @@ VfatAllocateIrpContext(
|
|||
IrpContext->MinorFunction = IrpContext->Stack->MinorFunction;
|
||||
IrpContext->FileObject = IrpContext->Stack->FileObject;
|
||||
IrpContext->Flags = IRPCONTEXT_COMPLETE;
|
||||
if (MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL ||
|
||||
MajorFunction == IRP_MJ_DEVICE_CONTROL ||
|
||||
MajorFunction == IRP_MJ_SHUTDOWN)
|
||||
|
||||
/* Easy cases that can wait */
|
||||
if (MajorFunction == IRP_MJ_CLEANUP ||
|
||||
MajorFunction == IRP_MJ_CREATE ||
|
||||
MajorFunction == IRP_MJ_SHUTDOWN ||
|
||||
MajorFunction == IRP_MJ_CLOSE /* likely to be fixed */)
|
||||
{
|
||||
IrpContext->Flags |= IRPCONTEXT_CANWAIT;
|
||||
SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
|
||||
}
|
||||
else if (MajorFunction != IRP_MJ_CLEANUP &&
|
||||
MajorFunction != IRP_MJ_CLOSE &&
|
||||
/* Cases that can wait if synchronous IRP */
|
||||
else if ((MajorFunction == IRP_MJ_DEVICE_CONTROL ||
|
||||
MajorFunction == IRP_MJ_QUERY_INFORMATION ||
|
||||
MajorFunction == IRP_MJ_SET_INFORMATION ||
|
||||
MajorFunction == IRP_MJ_FLUSH_BUFFERS ||
|
||||
MajorFunction == IRP_MJ_LOCK_CONTROL ||
|
||||
MajorFunction == IRP_MJ_QUERY_VOLUME_INFORMATION ||
|
||||
MajorFunction == IRP_MJ_SET_VOLUME_INFORMATION ||
|
||||
MajorFunction == IRP_MJ_DIRECTORY_CONTROL ||
|
||||
MajorFunction == IRP_MJ_WRITE ||
|
||||
MajorFunction == IRP_MJ_READ) &&
|
||||
IoIsOperationSynchronous(Irp))
|
||||
{
|
||||
IrpContext->Flags |= IRPCONTEXT_CANWAIT;
|
||||
SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
|
||||
}
|
||||
/* Cases that can wait if synchronous or if no FO */
|
||||
else if ((MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL ||
|
||||
MajorFunction == IRP_MJ_PNP) &&
|
||||
(IoGetCurrentIrpStackLocation(Irp)->FileObject == NULL ||
|
||||
IoIsOperationSynchronous(Irp)))
|
||||
{
|
||||
SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
|
||||
}
|
||||
|
||||
KeInitializeEvent(&IrpContext->Event, NotificationEvent, FALSE);
|
||||
IrpContext->RefCount = 0;
|
||||
IrpContext->PriorityBoost = IO_NO_INCREMENT;
|
||||
|
|
Loading…
Reference in a new issue