IPR_MJ_CLOSE

Hi all,

Can someone tell me what is the purpose of IRP_MJ_CLOSE and when is the
request generated? In the ddk its mentioned that when a handle to a file
object is released, it is sent. I am currently refereing to filemon driver
from sysinternals. But I observed that irp_mj_close requests were not
generated frequently. Why?

Regards.


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

The IRP_MJ_CLOSE is sent when the reference count for the file
object reaches zero (see ObDereferenceObject). It is NOT sent because the
handle count reaches zero (an IRP_MJ_CLEANUP is sent in this case).
The reason you are not seeing many closes is due to the fact that
some system components (e.g. the cache manager) are explicitly reference
counting the file objects, effectively postponing the close until said
component deems it neccessary to dereference the file object.

-----Original Message-----
From: xxxxx@yahoo.com [mailto:xxxxx@yahoo.com]
Sent: Friday, August 24, 2001 2:30 AM
To: File Systems Developers
Subject: [ntfsd] IPR_MJ_CLOSE

Hi all,

Can someone tell me what is the purpose of IRP_MJ_CLOSE and when is the
request generated? In the ddk its mentioned that when a handle to a file
object is released, it is sent. I am currently refereing to filemon driver
from sysinternals. But I observed that irp_mj_close requests were not
generated frequently. Why?

Regards.


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


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

Hi,

An IRP_MJ_CLOSE is sent when the reference count of the file object goes
down to 0, when it is being deleted.
Calling the Win32 API CloseHandle does not always cause this IRP to be
fired. Indeed, another process may have a duplicate handle on the same file
object.

-Sebastien

From: xxxxx@yahoo.com
Reply-To: “File Systems Developers”
>To: “File Systems Developers”
>Subject: [ntfsd] IPR_MJ_CLOSE
>Date: Fri, 24 Aug 2001 6:29:51
>
>Hi all,
>
>Can someone tell me what is the purpose of IRP_MJ_CLOSE and when is the
>request generated? In the ddk its mentioned that when a handle to a file
>object is released, it is sent. I am currently refereing to filemon driver
>from sysinternals. But I observed that irp_mj_close requests were not
>generated frequently. Why?
>
>Regards.
>
>—
>You are currently subscribed to ntfsd as: xxxxx@hotmail.com
>To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

_________________________________________________________________
Téléchargez MSN Explorer gratuitement à l’adresse
http://explorer.msn.fr/intl.asp


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

Yes, they aren’t.
However, I cannot tell when exactly they are certainly called:-)
If you make a small program that creates a file (and holds the handle),
and then opens the same file (having two handles now), then released one
handle (via CloseHandle), you will see IRP_MJ_CLEANUP and IRP_MJ_CLOSE for
that handle, and calling CloseHandle on the second handle will generate
another pair of the above IRPs.

Regards, Dejan.

xxxxx@yahoo.com wrote:

Hi all,

Can someone tell me what is the purpose of IRP_MJ_CLOSE and when is the
request generated? In the ddk its mentioned that when a handle to a file
object is released, it is sent. I am currently refereing to filemon driver
from sysinternals. But I observed that irp_mj_close requests were not
generated frequently. Why?

Regards.


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


Kind regards, Dejan M. CEO Alfa Co. www.alfasp.com
E-mail: xxxxx@alfasp.com
ICQ#: 56570367
Professional file&system related components and libraries for Win32
developers.
Alfa File Monitor - #1 file monitoring system for Win32 developers.
Alfa File Protector - #1 file protection and hiding system for Win32
developers.
Alfa Units - #1 file and system handling units for Delphi.


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

> Can someone tell me what is the purpose of IRP_MJ_CLOSE

Final cleanup of all structures private to your driver hanging off the file
object.
Deallocation of what is pointed by FileObject->FsContext and
FileObject->FsContext2.
Called just before deallocating a file object.

and when is the request generated?

IopDeleteFile method which is invoked when the handle+reference count of the
file object goes to zero. This can be user-mode CloseHandle or
ObDereferenceObject.

from sysinternals. But I observed that irp_mj_close requests were not
generated frequently. Why?

Because the files are usually cached, and the Cc holds stale cache maps for
hours.
A cache map holds a reference on file object.

Max


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

> Because the files are usually cached, and the Cc holds stale cache
maps

for hours. A cache map holds a reference on file object.

That’s the Mm (memory manager) through its DataSection (first element of
the SectionObjectPointers), not Cc (cache manager).

Cc is a thin interface layer between the FS and Mm, not much more.


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

>That’s the Mm (memory manager) through its DataSection (first element of

the SectionObjectPointers), not Cc (cache manager).
Cc is a thin interface layer between the FS and Mm, not much more.

Am I wrong that Mm’s control area lifetime (in the absense of user mappings)
is governed by Cc’s shared cache map lifetime?

Max


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

The only effect Cc has on the control area/data section lifetime is that
as long as it has *its* reference the data section cannot go away. Cc’s
datastructures are completely torn down shortly after cleanup, usually
asynchronously in the lazy writer thread pool. As soon as this happens
the data section can be reaped by Mm at will (assuming no other
references, such as by a user mapping, etc.), though it will hold on as
long as it can. This is the cache.

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Saturday, August 25, 2001 10:53 AM
To: File Systems Developers
Subject: [ntfsd] Re: IPR_MJ_CLOSE

That’s the Mm (memory manager) through its DataSection (first element
of the SectionObjectPointers), not Cc (cache manager). Cc is a thin
interface layer between the FS and Mm, not much more.

Am I wrong that Mm’s control area lifetime (in the absense of user
mappings) is governed by Cc’s shared cache map lifetime?

Max


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