- Acquire Spinlock at dpc level
- Release cancel spinlock at correct level
[PORTCLS]
- Check if current partially processed irp has been cancelled and complete it in that case
- Silence debug flood

svn path=/trunk/; revision=42335
This commit is contained in:
Johannes Anderwald 2009-08-02 12:38:08 +00:00
parent 9061b8ee40
commit aae0987d13
3 changed files with 16 additions and 9 deletions

View file

@ -1287,25 +1287,24 @@ KsCancelRoutine(
IN PIRP Irp) IN PIRP Irp)
{ {
PKSPIN_LOCK SpinLock; PKSPIN_LOCK SpinLock;
KIRQL OldLevel;
/* get internal queue lock */ /* get internal queue lock */
SpinLock = KSQUEUE_SPINLOCK_IRP_STORAGE(Irp); SpinLock = KSQUEUE_SPINLOCK_IRP_STORAGE(Irp);
/* acquire spinlock */ /* acquire spinlock */
KeAcquireSpinLock(SpinLock, &OldLevel); KeAcquireSpinLockAtDpcLevel(SpinLock);
/* sanity check */ /* sanity check */
ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
/* release cancel spinlock */ /* release cancel spinlock */
IoReleaseCancelSpinLock(DISPATCH_LEVEL); IoReleaseCancelSpinLock(Irp->CancelIrql);
/* remove the irp from the list */ /* remove the irp from the list */
RemoveEntryList(&Irp->Tail.Overlay.ListEntry); RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
/* release spinlock */ /* release spinlock */
KeReleaseSpinLock(SpinLock, OldLevel); KeReleaseSpinLockFromDpcLevel(SpinLock);
/* has the irp already been canceled */ /* has the irp already been canceled */
if (Irp->IoStatus.Status != STATUS_CANCELLED) if (Irp->IoStatus.Status != STATUS_CANCELLED)

View file

@ -165,10 +165,18 @@ IIrpQueue_fnGetMapping(
if (This->Irp) if (This->Irp)
{ {
/* use last irp */ /* use last irp */
Irp = This->Irp; if (This->Irp->Cancel == FALSE)
Offset = This->CurrentOffset; {
/* TODO cancel irp when required */ Irp = This->Irp;
ASSERT(Irp->Cancel == FALSE); Offset = This->CurrentOffset;
}
else
{
/* irp has been cancelled */
This->Irp->IoStatus.Status = STATUS_CANCELLED;
IoCompleteRequest(This->Irp, IO_NO_INCREMENT);
This->Irp = Irp = NULL;
}
} }
else else
{ {

View file

@ -970,7 +970,7 @@ IPortPinWaveCyclic_fnFastWrite(
PrePostRatio = (This->PreCompleted * 100) / This->TotalPackets; PrePostRatio = (This->PreCompleted * 100) / This->TotalPackets;
MinData = This->IrpQueue->lpVtbl->NumData(This->IrpQueue); MinData = This->IrpQueue->lpVtbl->NumData(This->IrpQueue);
DPRINT1("IPortPinWaveCyclic_fnFastWrite entered Total %u Pre %u Post %u State %x MinData %u Ratio %u\n", This->TotalPackets, This->PreCompleted, This->PostCompleted, This->State, This->IrpQueue->lpVtbl->NumData(This->IrpQueue), PrePostRatio); DPRINT("IPortPinWaveCyclic_fnFastWrite entered Total %u Pre %u Post %u State %x MinData %u Ratio %u\n", This->TotalPackets, This->PreCompleted, This->PostCompleted, This->State, This->IrpQueue->lpVtbl->NumData(This->IrpQueue), PrePostRatio);
Packet = (PCONTEXT_WRITE)Buffer; Packet = (PCONTEXT_WRITE)Buffer;
Irp = Packet->Irp; Irp = Packet->Irp;