IRP control

In my filter driver dispatch routine I setup a completion routine to always
be called.

The completion routine first checks to see if IRQL < DISPATCH_LEVEL, if not
a work item is created with IoAllocateWorkItem. The irp is sent as the
context in IoQueueWorkItem and the completion routine returns
STATUS_MORE_PROCESSING_REQUIRED. In the work item routine I finish up what
I need to do and then call IoCompleteRequest.

Things seem to work fine for a while but the eventually, while running
interactively with WinDbg, I am informed that the irp is already completed?

Is there something wrong with this approach? I thought that once I returned
STATUS_MORE_PROCESSING_REQUIRED in the completion routine I retain control
of the Irp until I make a subsequent call to IoCompleteRequest. Is there
something I am missing?


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

hi,

STATUS_MORE_PROCESSING_REQUIRED is used to return from a completion routine
only in cases like

  1. if you plan to send the irp back down to the lower driver or
  2. if the irp was created by the driver itself and the completion routine
    is going to deallocate it.

What you seem to be doing is that you are returning the completion routine
with STATUS_MORE_PROCESSING_REQUIRED for an irp that your driver has not
created and then you are calling IoCompleteRequest fot that Irp (which you
cannot touch now.). This might be crashing the system.

Probably you must redesign that piece of code.

Regards.


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

Or

  • you want to delay completion process

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.com
Sent: Saturday, February 16, 2002 12:00 AM
To: NT Developers Interest List
Subject: [ntdev] Re: IRP control

hi,

STATUS_MORE_PROCESSING_REQUIRED is used to return from a completion
routine
only in cases like

  1. if you plan to send the irp back down to the lower driver or
  2. if the irp was created by the driver itself and the completion
    routine
    is going to deallocate it.

What you seem to be doing is that you are returning the completion
routine
with STATUS_MORE_PROCESSING_REQUIRED for an irp that your driver has not

created and then you are calling IoCompleteRequest fot that Irp (which
you
cannot touch now.). This might be crashing the system.

Probably you must redesign that piece of code.

Regards.


You are currently subscribed to ntdev as: xxxxx@storagecraft.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

I redesigned the code to get around the problem, however, after doing more
reading I believe that the problem was in the dispatch routine. It passed
the same return code up as the lower level driver. Instead, it should pass
STATUS_PENDING if the completion routine will return
STATUS_MORE_PROCESSING_REQUIRED.

Unfortunately, I did not have time to confirm this. Might play with it next
week.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Saturday, February 16, 2002 11:12 AM
To: NT Developers Interest List
Subject: [ntdev] Re: IRP control

Or

  • you want to delay completion process

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.com
Sent: Saturday, February 16, 2002 12:00 AM
To: NT Developers Interest List
Subject: [ntdev] Re: IRP control

hi,

STATUS_MORE_PROCESSING_REQUIRED is used to return from a completion
routine
only in cases like

  1. if you plan to send the irp back down to the lower driver or
  2. if the irp was created by the driver itself and the completion
    routine
    is going to deallocate it.

What you seem to be doing is that you are returning the completion
routine
with STATUS_MORE_PROCESSING_REQUIRED for an irp that your driver has not

created and then you are calling IoCompleteRequest fot that Irp (which
you
cannot touch now.). This might be crashing the system.

Probably you must redesign that piece of code.

Regards.


You are currently subscribed to ntdev as: xxxxx@storagecraft.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@relicore.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

Right, the rule to remember is that if you are going to return
STATUS_MORE_PROCESSING_REQUIRED from your completion routine you should
either:

(a) return STATUS_PENDING from your dispatch routine; or
(b) block in your dispatch routine until the other code within your driver
indicates it is OK to return to the I/O Manager.

Of course, in case (a) you must also mark the IRP as pending.

Alas, the detailed explanation of why this is the case is one of the
challenging discussions to have about the I/O subsystem.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
?
Hope to see you at the next OSR file systems class March 11, 2002 in Boston!

-----Original Message-----
From: Stanislaw Kowalczyk [mailto:xxxxx@relicore.com]
Sent: Tuesday, February 19, 2002 11:50 AM
To: NT Developers Interest List
Subject: [ntdev] Re: IRP control

I redesigned the code to get around the problem, however, after doing more
reading I believe that the problem was in the dispatch routine. It passed
the same return code up as the lower level driver. Instead, it should pass
STATUS_PENDING if the completion routine will return
STATUS_MORE_PROCESSING_REQUIRED.

Unfortunately, I did not have time to confirm this. Might play with it next
week.


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