IoCsqInsertIrpEx and the pending flag set when I return STATUS_UNSUCCESSFUL

Hi All,
In spite of some confusion I (and others I guess) had due to lacking
documentation, from what I understood (from the thread I attached),
IoCsqInsertIrpEx does actually calls IoMarkIrpPending !
My question is under what conditions (if any)?
can I be sure that when my xxCsqInsertIrpEx returns STATUS_UNSUCCESSFUL,
IoCsqInsertIrpEx doesn’t set or reset the pending flag ? i.e.
(IoMarkIrpPending) -what will be the consequence if not?

I read this thread published About the Question if a call to
IoCsqInsertIrp or IoCsqInsertIrpEx should or should not be followed to a
call of IoMarkIrpPanding()
(http://www.winvistabeta.com/groups/450549/CSQ-and-IoMarkIrpPending/mess
age.aspx)

as I looked at the disassembly part(in the thread) I couldn’t see that
the insertion callback return value have any effect on setting/resetting
the pending flag, please advise .
http://www.winvistabeta.com/groups/450549/CSQ-and-IoMarkIrpPending/messa
ge.aspx
(look for Eliyas yakub [MSFT] response))

Thanks,
Have a great week
Daniel.

Get the latest news on SurfControl and our products,
subscribe to our monthly e-newsletter, SurfAdvisory at:
http://www.surfcontrol.com/resources/surfadvisory/surfadvisory_signup.aspx

*********************************************************************
The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
email by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution or any action taken
or omitted to be taken in reliance on it, is prohibited and may be
unlawful. If you believe that you have received this email in error,
please contact the sender.
*********************************************************************

Architecturally, there’s never been a model for “clearing” the pending bit. So “resetting” is not a valid option based upon the architecture of the I/O subsystem - once you set the bit, you are commited to returning STATUS_PENDING.

Were I coding this, in any case where I’d called IoMarkIrpPending, I’d call IoCompleteRequest in the case of an error and return STATUS_PENDING. That’s architecturally correct and will work, although it seems to confuse people (STATUS_PENDING doesn’t mean “still working on it” but rather it means “this operation is asynchronous with respect to the dispatch entry point”.)

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

On Oct 28, 2006, at 5:29 PM, xxxxx@osr.com wrote:

Architecturally, there’s never been a model for “clearing” the
pending bit. So “resetting” is not a valid option based upon the
architecture of the I/O subsystem - once you set the bit, you are
commited to returning STATUS_PENDING.

Incidentally, I did some more looking into this after Mark’s post
last week, and in some code I wrote, static driver verifier was
indeed flagging it as an error to set and then clear
SL_PENDING_RETURNED, even in the same routine (i.e. IoCsqInsertIrp
followed by IoCsqRemoveNextIrp and clearing the bit).

It asserted on both the IrpCompletion rule and the MarkIrpPending rule.

-sd

I reviewed the code for IoCsqInsertIrpEx and it only calls
IoMarkIrpPending if the IRP was successfully inserted into the queue.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
Rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Daniel Arosh
Sent: Monday, October 23, 2006 3:04 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] IoCsqInsertIrpEx and the pending flag set when I return
STATUS_UNSUCCESSFUL

Hi All,
In spite of some confusion I (and others I guess) had due to lacking
documentation, from what I understood (from the thread I attached),
IoCsqInsertIrpEx does actually calls IoMarkIrpPending !
My question is under what conditions (if any)?
can I be sure that when my xxCsqInsertIrpEx returns STATUS_UNSUCCESSFUL,
IoCsqInsertIrpEx doesn’t set or reset the pending flag ? i.e.
(IoMarkIrpPending) -what will be the consequence if not?

I read this thread published About the Question if a call to
IoCsqInsertIrp or IoCsqInsertIrpEx should or should not be followed to a
call of IoMarkIrpPanding()
(http://www.winvistabeta.com/groups/450549/CSQ-and-IoMarkIrpPending/mess
age.aspx)

as I looked at the disassembly part(in the thread) I couldn’t see that
the insertion callback return value have any effect on setting/resetting
the pending flag, please advise .
http://www.winvistabeta.com/groups/450549/CSQ-and-IoMarkIrpPending/messa
ge.aspx
(look for Eliyas yakub [MSFT] response))

Thanks,
Have a great week
Daniel.

Get the latest news on SurfControl and our products,
subscribe to our monthly e-newsletter, SurfAdvisory at:
http://www.surfcontrol.com/resources/surfadvisory/surfadvisory_signup.as
px

*********************************************************************
The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
email by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution or any action taken
or omitted to be taken in reliance on it, is prohibited and may be
unlawful. If you believe that you have received this email in error,
please contact the sender.
*********************************************************************


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thank you Steve, Tony and Neal!

Could you please take a look and tell me if I should undo the comment
out(in line Ln.xxx) and return STATUS_PENDING or returning the same
value as I am setting in the Irp->IoStatus.Status field is also fine in
this cases (this is my read dispatch routine for a function driver that
binds to a fixed fsd ,it should only Queue irps or return failure when
needed)

NTSTATUS ProcessManager::OnDeviceRead(IN PDEVICE_OBJECT DeviceObject, IN
PIRP Irp)

{

NTSTATUS status = STATUS_SUCCESS;

if(0 == m_lConnected || m_pIrpQueue == 0 || m_lTerminating)

Irp->IoStatus.Status = status =
STATUS_DEVICE_NOT_CONNECTED;

else {

KeEnterCriticalRegion();

if(TRUE ==
ExAcquireResourceSharedLite(&m_rRegistrationRWGaurd, FALSE)) {

if(m_pIrpQueue){

if( NT_SUCCESS(
m_pIrpQueue->Insert(Irp)) )//either STATUS_SUCCESS or
STATUS_UNSUCCESSFUL

status =
Irp->IoStatus.Status = STATUS_PENDING;

else //we can be sure in
this case that IoCsqInsertIrpEx knows we fail and don’t set the pending
bit
status = Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; // the irp failed
to be queued

}

else

status =
Irp->IoStatus.Status = STATUS_DEVICE_REQUIRES_CLEANING;

ExReleaseResourceLite(&m_rRegistrationRWGaurd);

} else

status = Irp->IoStatus.Status =
STATUS_DEVICE_REQUIRES_CLEANING;

KeLeaveCriticalRegion();

}

if(FALSE == NT_SUCCESS(Irp->IoStatus.Status))

{

Irp->IoStatus.Information = 0;

Ln.xxx //status = STATUS_PENDING;

IoCompleteRequest(Irp, IO_NO_INCREMENT);

}

return status;

}

Thank you all for clearing this out for me !

Daniel.

P.S.

Any other comments will welcomed!

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Neal
Christiansen
Sent: Tuesday, October 31, 2006 6:19 AM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] IoCsqInsertIrpEx and the pending flag set when I
return STATUS_UNSUCCESSFUL

I reviewed the code for IoCsqInsertIrpEx and it only calls

IoMarkIrpPending if the IRP was successfully inserted into the queue.

Neal Christiansen

Microsoft File System Filter Group Lead

This posting is provided “AS IS” with no warranties, and confers no

Rights

-----Original Message-----

From: xxxxx@lists.osr.com

[mailto:xxxxx@lists.osr.com] On Behalf Of Daniel Arosh

Sent: Monday, October 23, 2006 3:04 AM

To: Windows File Systems Devs Interest List

Subject: [ntfsd] IoCsqInsertIrpEx and the pending flag set when I return

STATUS_UNSUCCESSFUL

Hi All,

In spite of some confusion I (and others I guess) had due to lacking

documentation, from what I understood (from the thread I attached),

IoCsqInsertIrpEx does actually calls IoMarkIrpPending !

My question is under what conditions (if any)?

can I be sure that when my xxCsqInsertIrpEx returns STATUS_UNSUCCESSFUL,

IoCsqInsertIrpEx doesn’t set or reset the pending flag ? i.e.

(IoMarkIrpPending) -what will be the consequence if not?

I read this thread published About the Question if a call to

IoCsqInsertIrp or IoCsqInsertIrpEx should or should not be followed to a

call of IoMarkIrpPanding()

(http://www.winvistabeta.com/groups/450549/CSQ-and-IoMarkIrpPending/mess

age.aspx)

as I looked at the disassembly part(in the thread) I couldn’t see that

the insertion callback return value have any effect on setting/resetting

the pending flag, please advise .

http://www.winvistabeta.com/groups/450549/CSQ-and-IoMarkIrpPending/messa

ge.aspx

(look for Eliyas yakub [MSFT] response))

Thanks,

Have a great week

Daniel.

Get the latest news on SurfControl and our products,

subscribe to our monthly e-newsletter, SurfAdvisory at:

http://www.surfcontrol.com/resources/surfadvisory/surfadvisory_signup.as

px

*********************************************************************

The information in this email is confidential and may be legally

privileged. It is intended solely for the addressee. Access to this

email by anyone else is unauthorized. If you are not the intended

recipient, any disclosure, copying, distribution or any action taken

or omitted to be taken in reliance on it, is prohibited and may be

unlawful. If you believe that you have received this email in error,

please contact the sender.

*********************************************************************


Questions? First check the IFS FAQ at

https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:

‘’

To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’

To unsubscribe send a blank email to xxxxx@lists.osr.com

Get the latest news on SurfControl and our products,
subscribe to our monthly e-newsletter, SurfAdvisory at:
http://www.surfcontrol.com/resources/surfadvisory/surfadvisory_signup.aspx

*********************************************************************
The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
email by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution or any action taken
or omitted to be taken in reliance on it, is prohibited and may be
unlawful. If you believe that you have received this email in error,
please contact the sender.
*********************************************************************