Hi Dave,
I went through my old notes. You are correct and in most cases
IoCompleteRequest() will issue an MmUnlockPages() for each MDL in the IRP
chain. There are however few exceptions: one is MDLs for associated IRPs,
it’s expected that those MDLs have been initialized with
IoBuildPartialMdl(). Another exception is PAGING_IO irps, the i/o completion
code doesn’t do anything to MDLs of those IRPs.
sara
----- Original Message -----
From: “Sara Abraham”
To: “NT Developers Interest List”
Sent: Wednesday, December 20, 2000 5:14 PM
Subject: [ntdev] RE: [NTDev] Proper order of tearing down an MDL …
> Hi Dave,
>
> >
> > Now that you’ve got me thinking about it again…
> >
> > Have a look in a debugger at the actual disassembly of MmUnlockPages().
> > The first thing it does is test byte 6 of the MDL (MdlFlags) for bit
0x01
> > (MDL_MAPPED_TO_SYSTEM_VA), then conditionally calls
MmUnmapLockedPages().
> >
> > So, though IoFreeMdl() doesn’t unmap unless MDL_PARTIAL_HAS_BEEN_MAPPED
> > is set, ‘direct’ I/O MDLs are going to be unmapped by virtue of being
> > unlocked.
> >
>
>
> You are correct that MmUnlockPages() will do the unmap. But, Gary’s
> original question was if we can rely on the i/o manager to issue the
> MmUnlockPages() , or does it need to be done in the driver’s completion
> routine. I suspect that if the driver allocates MDLs that are not of type
> MDL_PARTIAL, then it’s the driver’s responsibilty to unlock/unmap.
> Are you saying that IoCompleteRequest() will always issue MmUnlockPages()
> for any MDL ?
>
> Sara
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@veritas.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com