Author: arty Date: Mon Jul 28 07:38:47 2008 New Revision: 34899
URL: http://svn.reactos.org/svn/reactos?rev=34899&view=rev Log: Fix (among other things) failure to boot when a CD is not inserted, caused by the new (correct) ASSERT in mutex acquisition in MmProbeAndLockPages, which was erroneously being called from IoBuildAsynchronousFsdRequest at DISPATCH_LEVEL.
The only correct course of action when calling IoBuildAsynchronousFsdRequest at DISPATCH_LEVEL is to MmBuildMdlForNonPagedPool since the buffer must be nonpaged (if the IRP completes synchronously, we'll still be at DISPATCH_LEVEL) This is the case when direct io is done at DISPATCH_LEVEL using IoBuildAsynchronousFsdRequest.
Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c trunk/reactos/ntoskrnl/io/iomgr/irp.c
Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport/sc... ============================================================================== --- trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] Mon Jul 28 07:38:47 2008 @@ -4405,7 +4405,8 @@
if (Irp->MdlAddress != NULL) { - MmUnlockPages(Irp->MdlAddress); + /* We don't need to unlock this MDL because the request could + * only have come from dispatch level */ IoFreeMdl(Irp->MdlAddress); Irp->MdlAddress = NULL; }
Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Mon Jul 28 07:38:47 2008 @@ -682,23 +682,30 @@ return NULL; }
- /* Probe and Lock */ - _SEH_TRY - { - /* Do the probe */ - MmProbeAndLockPages(Irp->MdlAddress, - KernelMode, - MajorFunction == IRP_MJ_READ ? - IoWriteAccess : IoReadAccess); - } - _SEH_HANDLE - { - /* Free the IRP and its MDL */ - IoFreeMdl(Irp->MdlAddress); - IoFreeIrp(Irp); - Irp = NULL; - } - _SEH_END; + if (KeGetCurrentIrql() >= DISPATCH_LEVEL) + { + MmBuildMdlForNonPagedPool(Irp->MdlAddress); + } + else + { + /* Probe and Lock */ + _SEH_TRY + { + /* Do the probe */ + MmProbeAndLockPages(Irp->MdlAddress, + KernelMode, + MajorFunction == IRP_MJ_READ ? + IoWriteAccess : IoReadAccess); + } + _SEH_HANDLE + { + /* Free the IRP and its MDL */ + IoFreeMdl(Irp->MdlAddress); + IoFreeIrp(Irp); + Irp = NULL; + } + _SEH_END; + }
/* This is how we know if we failed during the probe */ if (!Irp) return NULL; @@ -1344,7 +1351,7 @@ Mdl = Irp->MdlAddress; while (Mdl) { - MmUnlockPages(Mdl); + MmUnlockPages(Mdl); Mdl = Mdl->Next; }