Sin-Lam:
First, yes, the article should say “… from the FILE_OBJECT are zero”. The
point is that if one of these pointers is non-zero, there’s still a file
object lurking around somewhere that you just don’t know about.
You should see an IRP_MJ_CLOSE on the file object backing the section object
pointer. In other words, you will see an IRP_MJ_CLOSE where
FileObject->SectionObjectPointers will be the same location in memory, but
the two section object pointers will both be NULL. If you use the
“standard” trick of tracking state based upon the FsContext field, that file
object will have the proper FsContext field, you’ll look again at the
SectionObjectPointers structure and if both those fields are ZERO, then you
can safely delete your per-file context.
Of course, all of this is much easier in Windows XP, since you can exploit
the context structures.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: Tan Sin Lam [mailto:xxxxx@lit.org.sg]
Sent: Thursday, May 30, 2002 5:55 AM
To: File Systems Developers
Subject: [ntfsd] Question on Reference Counting from NT Insider (March -
April 2002)
Hi,
I use the simple Reference Counting algorithm as suggested in the NT
Insider and it works pretty well. Thanks to OSR. I have a question on the
page 18,
“If the reference count for the per-file context structure reaches zero and
both the ImageSectionObject and DataSectionObject of the
SectionObjectPointers field from the FILE_OBJECT is non-zero (should be
zero?? ) the filter driver may then delete the per-file context data.”
My question is if one of the pointers of SectionObjectPointer are non-zero,
I still keep the per-context data, but I don’t know when is the time to
deallocate the per-context data. The OS will not send another close
operation when both pointers of the SectionObjectPointer field are zero. So
it always kept in my driver until the Fcb has been overwritten by a
different file. BTW, I do all these in the close dispatch routine.
For example, if I copied few thousands of files, I saw a few hundreds of
entries kept in my driver due to SectionObjectPointer is not null when the
reference count is zero. Any suggestion is welcomed.
Thanks,
Sin-Lam
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%