ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
ASSERT(FDODeviceExtension->Common.IsFDO);
+ //
+ // this IRP isn't in our list here
+ //
+
+ //
+ // now release the cancel lock
+ //
+ IoReleaseCancelSpinLock(Irp->CancelIrql);
+
+ //
+ // set cancel status
+ //
+ Irp->IoStatus.Status = STATUS_CANCELLED;
+
+ //
+ // now cancel the irp
+ //
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+}
+
+VOID
+NTAPI
+USBSTOR_Cancel(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
+{
+ PFDO_DEVICE_EXTENSION FDODeviceExtension;
+
+ //
+ // get FDO device extension
+ //
+ FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+
+ //
+ // sanity check
+ //
+ ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
+ ASSERT(FDODeviceExtension->Common.IsFDO);
+
//
// acquire irp list lock
//
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
-
BOOLEAN
USBSTOR_QueueAddIrp(
IN PDEVICE_OBJECT DeviceObject,
//
// now set the driver cancel routine
//
- OldDriverCancel = IoSetCancelRoutine(Irp, USBSTOR_CancelIo);
+ if (SrbProcessing)
+ {
+ OldDriverCancel = IoSetCancelRoutine(Irp, USBSTOR_Cancel);
+ }
+ else
+ {
+ OldDriverCancel = IoSetCancelRoutine(Irp, USBSTOR_CancelIo);
+ }
//
// check if the irp has already been cancelled
//
// cancel irp
//
- USBSTOR_CancelIo(DeviceObject, Irp);
+ Irp->CancelRoutine(DeviceObject, Irp);
//
// irp was cancelled
PIRP Irp;
PIO_STACK_LOCATION IoStack;
PSCSI_REQUEST_BLOCK Request;
+ KIRQL OldIrql;
//
// get FDO device extension
//
Irp = (PIRP)CONTAINING_RECORD(Entry, IRP, Tail.Overlay.ListEntry);
+ //
+ // remove the cancellation routine
+ //
+ IoAcquireCancelSpinLock(&OldIrql);
+ (void)IoSetCancelRoutine(Irp, NULL);
+ IoReleaseCancelSpinLock(OldIrql);
+
//
// get current stack location
//
//
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ //
+ // release lock
+ //
+ KeReleaseSpinLock(&FDODeviceExtension->IrpListLock, OldLevel);
+
//
// complete request
//
IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ //
+ // acquire lock
+ //
+ KeAcquireSpinLock(&FDODeviceExtension->IrpListLock, &OldLevel);
}
-
- //
- // release lock
- //
- KeReleaseSpinLock(&FDODeviceExtension->IrpListLock, OldLevel);
}
VOID