[USBSTOR]

- Don't leave DISPATCH_LEVEL while holding a spin lock acquired at DISPATCH_LEVEL
- Synchronize cancellation checking by acquiring the cancel spin lock

svn path=/branches/usb-bringup/; revision=52071
This commit is contained in:
Cameron Gutman
2011-06-03 05:38:27 +00:00
parent ab7ce0c45c
commit 392e4b95be
+23 -23
View File
@@ -55,11 +55,6 @@ USBSTOR_CancelIo(
//
KeAcquireSpinLockAtDpcLevel(&FDODeviceExtension->IrpListLock);
//
// now release the cancel lock
//
IoReleaseCancelSpinLock(Irp->CancelIrql);
//
// remove the irp from the list
//
@@ -68,7 +63,12 @@ USBSTOR_CancelIo(
//
// release irp list lock
//
KeReleaseSpinLockFromDpcLevel(&FDODeviceExtension->IrpListLock);
KeReleaseSpinLockFromDpcLevel(&FDODeviceExtension->IrpListLock);
//
// now release the cancel lock
//
IoReleaseCancelSpinLock(Irp->CancelIrql);
//
// set cancel status
@@ -131,6 +131,21 @@ USBSTOR_QueueAddIrp(
//
FDODeviceExtension->IrpPendingCount++;
//
// check if queue is freezed
//
IrpListFreeze = FDODeviceExtension->IrpListFreeze;
//
// release list lock
//
KeReleaseSpinLock(&FDODeviceExtension->IrpListLock, OldLevel);
//
// synchronize with cancellations by holding the cancel lock
//
IoAcquireCancelSpinLock(&Irp->CancelIrql);
//
// now set the driver cancel routine
//
@@ -141,16 +156,6 @@ USBSTOR_QueueAddIrp(
//
if (Irp->Cancel && OldDriverCancel == NULL)
{
//
// the irp has already been cancelled
//
KeReleaseSpinLock(&FDODeviceExtension->IrpListLock, OldLevel);
//
// cancel routine requires that cancel spinlock is held
//
IoAcquireCancelSpinLock(&Irp->CancelIrql);
//
// cancel irp
//
@@ -163,14 +168,9 @@ USBSTOR_QueueAddIrp(
}
//
// check if queue is freezed
// release the cancel lock
//
IrpListFreeze = FDODeviceExtension->IrpListFreeze;
//
// release list lock
//
KeReleaseSpinLock(&FDODeviceExtension->IrpListLock, OldLevel);
IoReleaseCancelSpinLock(Irp->CancelIrql);
//
// if list is freezed, dont start this packet