Author: arty Date: Mon Jul 7 22:01:56 2008 New Revision: 34361
URL: http://svn.reactos.org/svn/reactos?rev=34361&view=rev Log: Move completion out of the spinlock. Spotted by aicom
Modified: trunk/reactos/drivers/network/afd/afd/event.c
Modified: trunk/reactos/drivers/network/afd/afd/event.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/eve... ============================================================================== --- trunk/reactos/drivers/network/afd/afd/event.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/event.c [iso-8859-1] Mon Jul 7 22:01:56 2008 @@ -141,6 +141,7 @@ NTSTATUS Status; KIRQL OldIrql; ULONG Count; + BOOLEAN CompleteIrp;
AFD_DbgPrint(MAX_TRACE, ("Called.\n"));
@@ -173,7 +174,7 @@
KeAcquireSpinLock(&FCB->ReceiveQueueLock, &OldIrql);
- if (!IsListEmpty(&FCB->ReadRequestQueue)) { + if (CompleteIrp = !IsListEmpty(&FCB->ReadRequestQueue)) { AFD_DbgPrint(MAX_TRACE, ("Satisfying read request.\n"));
Entry = RemoveHeadList(&FCB->ReceiveQueue); @@ -190,15 +191,15 @@
ReadRequest->Irp->IoStatus.Information = 0; ReadRequest->Irp->IoStatus.Status = Status; - + } + + KeReleaseSpinLock(&FCB->ReceiveQueueLock, OldIrql); + + if (CompleteIrp) { AFD_DbgPrint(MAX_TRACE, ("Completing IRP at (0x%X).\n", ReadRequest->Irp)); - IoCompleteRequest(ReadRequest->Irp, IO_NETWORK_INCREMENT); + *BytesTaken = BytesAvailable; } - - KeReleaseSpinLock(&FCB->ReceiveQueueLock, OldIrql); - - *BytesTaken = BytesAvailable;
AFD_DbgPrint(MAX_TRACE, ("Leaving.\n"));