Processing of a close request

Hello,
this question is about processing close request (IRP_MJ_CLOSE) in file
system driver.
For example, CDFS driver post request to queue (if it can’t acquire
resources without blocking) and then returns STATUS_SUCCESS.
Why processing of a IRP_MJ_CLOSE is so difficult ?
Is the reason ‘ObDereferenceObject’ (that is called when destroying FCB
and that cause recursive call of the fsd close) ?

Hi Max,
The IRP_MJ_CLOSE is special in that it cannot fail.
Even if an error is returned, it is ignored.
It is also inherently synchronous.
So FSDs always(?) return STATUS_SUCCESS.
If resources cannot be acquired, then one way of
handling it is to:

  1. ‘remember’ all necessary info
  2. posting the request to a queue
  3. Complete the IRP
  4. Return STATUS_SUCCESS.
  5. Do the necessary cleanup in the asynchronous
    handler.
    You could also post it and complete the Irp later.
    But the other way is better.
    Does that answer your query?
    Regards,
    Manoj

— Max Woo wrote: > Hello,
> this question is about processing close request
> (IRP_MJ_CLOSE) in file
> system driver.
> For example, CDFS driver post request to queue (if
> it can’t acquire
> resources without blocking) and then returns
> STATUS_SUCCESS.
> Why processing of a IRP_MJ_CLOSE is so difficult ?
> Is the reason ‘ObDereferenceObject’ (that is called
> when destroying FCB
> and that cause recursive call of the fsd close) ?
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
%%email.unsub%%

=====
-----------------------------------
Manoj Paul Joseph,
Master of Computer Applications (final year student),
School of Computer Science and Engineering,
Anna University,
Chennai (Madras),
India.

________________________________________________________________________
Looking for a job? Visit Yahoo! India Careers
Visit http://in.careers.yahoo.com

Hi Manoj,
thanks for your answer.
I have one more question. Is performance the only reason of such
asynchronous processing of close request ? R. Nagaar in his book wrote
that ‘blocking a close request will lead to some very unexpected deadlock
conditions’. If I block a close request, what kind of a deadlock can occur
?

Manoj Paul Joseph,

The IRP_MJ_CLOSE is special in that it cannot fail.
Even if an error is returned, it is ignored.
It is also inherently synchronous.
So FSDs always(?) return STATUS_SUCCESS.

Have you met this case that the FsContext of the fileobject is not your FCB object ?
I’ll get it in my fsd when copying too many files.

I don’t know where it comes and just ignore it.

Thanks in advance,

========================
Matt Wu
E-Mail: mattwu@163.com
WebSite:http://sys.xiloo.com

If resources cannot be acquired, then one way of
handling it is to:

  1. ‘remember’ all necessary info
  2. posting the request to a queue
  3. Complete the IRP
  4. Return STATUS_SUCCESS.
  5. Do the necessary cleanup in the asynchronous
    handler.
    You could also post it and complete the Irp later.
    But the other way is better.
    Does that answer your query?
    Regards,
    Manoj

— Max Woo wrote: > Hello,
>> this question is about processing close request
>> (IRP_MJ_CLOSE) in file
>> system driver.
>> For example, CDFS driver post request to queue (if
>> it can’t acquire
>> resources without blocking) and then returns
>> STATUS_SUCCESS.
>> Why processing of a IRP_MJ_CLOSE is so difficult ?
>> Is the reason ‘ObDereferenceObject’ (that is called
>> when destroying FCB
>> and that cause recursive call of the fsd close) ?
>>
>> —
>> You are currently subscribed to ntfsd as:
>> xxxxx@yahoo.com
>> To unsubscribe send a blank email to
>%%email.unsub%%
>
>=====
>-----------------------------------
>Manoj Paul Joseph,
>Master of Computer Applications (final year student),
>School of Computer Science and Engineering,
>Anna University,
>Chennai (Madras),
>India.
>
> ________________________________________________________________________
>Looking for a job? Visit Yahoo! India Careers
> Visit http://in.careers.yahoo.com
>
>—
>You are currently subscribed to ntfsd as: mattwu@163.com
>To unsubscribe send a blank email to %%email.unsub%%