RE: Tony,please.Question about Reference Counting art icle in NT Insider?

> Imagine we use your scenario, but that second IRP is for a query
information

call. In that case, the I/O Manager allocates the file object on the
stack.
Since this is the FIRST file object to be used for I/O, it backs the
section
object. That leads to horrible problems because it is not a REAL file
object, but has now been used to back the section object.

So, I argue that your model is defective on the surface because it
wouldn’t
work without reference counting. Thus, I don’t think we need to make an
already defective model work.

If the file object is only opened and closed immediately (for example to
determine whether file exists or not, or whether this is a directory) or
only used for some query info requests, caching will not be initialized,
then it means that Cc will not hold any reference to the file object, then
it means that this scenario may work.

-htfv

From your original post I understood that IRP_MJ_CLOSE IRP was caused by
IRP_MJ_CREATE IRP on the same file object. Sorry for the confusion.

In you case nothing wrong will happen. In IRP_MJ_CLOSE IRP processing you
will drop your context. When IRP_MJ_CREATE IRP completes you will create a
new context record. So, nothing’s wrong here.

-htfv

----- Original Message -----
From: “ecore”
To: “File Systems Developers”
Sent: Saturday, August 30, 2003 5:54 AM
Subject: [ntfsd] RE: Tony,please.Question about Reference Counting art icle
in NT Insider?

> Oh,God!That complex and hideous scenario is not the Scenario I refer.
> My description is,for these file objects with the same FCB,there is the
> scenario:
> 1.File Object A IRP_MJ_CREATE Completed,so I increase an reference
> count;So,the count=1;
> 2.File Object B IRP_MJ_CREATE reached,not completed,when I pass it to the
> FSD,will it
> lead to the IRP_MJ_CLOSE for File Object A?
> I think it will.Right???
> 3.So,in File Object A IRP_MJ_CLOSE,I decrease an reference count.So,the
> Count=0;
> I delete the Entry from my record table.
>
> OK,in File Object B IRP_MJ_CREATE Completion,I will find no entry for the
> FCB,so I create
> a new entry for the FCB.BUT,my entry isnot so simple,it needs many
> infomation;So,I can’t delete
> the entry at this clock:
> File Object B IRP_MJ_CREATE reached(not completed),I find the entry for
> fileobject B’s FCB.
> But,at the Completion routine(for File Object B IRP_MJ_CREATE),the entry
> have already deleted.
>
> Oh,if 2 is right.I have to guarantee the entry will not be deleted by
> other ways.
>
> —
> You are currently subscribed to ntfsd as: xxxxx@vba.com.by
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

Right, the problem was found. But this is the problem when you initialize
caching. If don’t intialize cache you may implement your code as usual. This
thread is not about it. The original poster described scenario when passing
IRP_MJ_CREATE IRP to lower driver may cause receiving recursive IRP_MJ_CLOSE
IRP (as I believed), which is quite possible.

-htfv

----- Original Message -----
From: “Nick Ryan”
Newsgroups: ntfsd
To: “File Systems Developers”
Sent: Saturday, August 30, 2003 8:31 PM
Subject: [ntfsd] Re: Tony,please.Question about Reference Counting art icle
in NT Insider?

> But the problem that’s been found is that other filter drivers may do
> something to initialize the cache (like a non-cached read/write) even
> for a simple open/close.
>
> Alexey Logachyov wrote:
>
> >>Imagine we use your scenario, but that second IRP is for a query
> >
> > information
> >
> >>call. In that case, the I/O Manager allocates the file object on the
> >
> > stack.
> >
> >>Since this is the FIRST file object to be used for I/O, it backs the
> >
> > section
> >
> >>object. That leads to horrible problems because it is not a REAL file
> >>object, but has now been used to back the section object.
> >
> >
> >>So, I argue that your model is defective on the surface because it
> >
> > wouldn’t
> >
> >>work without reference counting. Thus, I don’t think we need to make an
> >>already defective model work.
> >
> >
> > If the file object is only opened and closed immediately (for example to
> > determine whether file exists or not, or whether this is a directory) or
> > only used for some query info requests, caching will not be initialized,
> > then it means that Cc will not hold any reference to the file object,
then
> > it means that this scenario may work.
> >
> > -htfv
> >
> >
> >
> >
> >
> >
>
> –
> Nick Ryan (MVP for DDK)
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@vba.com.by
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

Saying that ANY filter in the stack can cause Mm/Cc to grab a reference to
the file object doesn’t mean that it will do that. If this really was a very
big problem MS would fix I/O Manager behaviour. FSFDs were written for many
years without using IoCancelFileOpen and without knowing about this bug (or
whatever you call it). I understand that it is always a good idea to follow
MS/OSR documentation/recommendations. But ill drivers still often appear on
the market. And you can do nothing to change that. Perhaps, you can make
your customers use or not use this or that software. I can’t nor want to do
that. So, if there is some other filter driver installed which interferes
with mine, I fix mine.

P.S. There was ‘you’ there because that is how I say it in my language. This
list is international. People from many different countries are reading this
list. Every language has its own pecularities and it is often difficult if
not impossible to correlate structures from native language with ones from
English. Many people for whom English is native language forget about those
people from other countries. Reading the last flame in ntdev list on open
sources is a torture. People, could you be a litle bit simplier in your
words? We all have to be tolerant to each other. Otherwise our community is
worth nothing.

-htfv

----- Original Message -----
From: “Nick Ryan”
Newsgroups: ntfsd
To: “File Systems Developers”
Sent: Saturday, August 30, 2003 11:00 PM
Subject: [ntfsd] Re: Tony,please.Question about Reference Counting art icle
in NT Insider?

> There is no ‘you’ here. ANY filter in the stack can cause Mm or Cc to
> grab a reference to the file object by performing side requests using
> the file object. The only way to guard against this by derefencing the
> file object using ObDereferenceObject (not by throwing down a close),
> and in addition to only use a stream file object allocated by the filter
> itself, not the file object in the stack.
>
> Alexey Logachyov wrote:
>
> > Right, the problem was found. But this is the problem when you
initialize
> > caching. If don’t intialize cache you may implement your code as usual.
This
> > thread is not about it. The original poster described scenario when
passing
> > IRP_MJ_CREATE IRP to lower driver may cause receiving recursive
IRP_MJ_CLOSE
> > IRP (as I believed), which is quite possible.
> >
> > -htfv
> >
> >
> >
> > ----- Original Message -----
> > From: “Nick Ryan”
> > Newsgroups: ntfsd
> > To: “File Systems Developers”
> > Sent: Saturday, August 30, 2003 8:31 PM
> > Subject: [ntfsd] Re: Tony,please.Question about Reference Counting art
icle
> > in NT Insider?
> >
> >
> >
> >>But the problem that’s been found is that other filter drivers may do
> >>something to initialize the cache (like a non-cached read/write) even
> >>for a simple open/close.
> >>
> >>Alexey Logachyov wrote:
> >>
> >>
> >>>>Imagine we use your scenario, but that second IRP is for a query
> >>>
> >>>information
> >>>
> >>>
> >>>>call. In that case, the I/O Manager allocates the file object on the
> >>>
> >>>stack.
> >>>
> >>>
> >>>>Since this is the FIRST file object to be used for I/O, it backs the
> >>>
> >>>section
> >>>
> >>>
> >>>>object. That leads to horrible problems because it is not a REAL file
> >>>>object, but has now been used to back the section object.
> >>>
> >>>
> >>>>So, I argue that your model is defective on the surface because it
> >>>
> >>>wouldn’t
> >>>
> >>>
> >>>>work without reference counting. Thus, I don’t think we need to make
an
> >>>>already defective model work.
> >>>
> >>>
> >>>If the file object is only opened and closed immediately (for example
to
> >>>determine whether file exists or not, or whether this is a directory)
or
> >>>only used for some query info requests, caching will not be
initialized,
> >>>then it means that Cc will not hold any reference to the file object,
> >
> > then
> >
> >>>it means that this scenario may work.
> >>>
> >>>-htfv
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>–
> >>Nick Ryan (MVP for DDK)
> >>
> >>
> >>—
> >>You are currently subscribed to ntfsd as: xxxxx@vba.com.by
> >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>
> >>
> >
> >
> >
> >
> >
> >
>
> –
> Nick Ryan (MVP for DDK)
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@vba.com.by
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

One thing I dont understand why someone has to bitch about others. I’m
certainly sick of this list. Quite frankly, the cut and paste technology was
first started with windows. MS recommended it. Use the examples, take some
boiler plate code and twick it to your need… Then there is flod of tech
books, with all kinds of examples. Quite often, younger ones need some
information, they hardly know the caveots of copyright(wrong) or copyleft
whatever anyone thinks about it. So they look upto the big guys for
information, so that they can get the job done. BUT THAT DOES NOT GIVE
ANYONE RIGHT TO SAY, I’M HELPING THEM TO FEED THEIR FAMILY. Complete
shithead in my opinion. They never came to beg a particular person, pls help
me. You are someone extend your hand, then comearound to say such things.
God!, unbelivable.

About a year or so ago, I saw the same thing, I mentioned about it, Dan
Partley(spell error !) said, it is not that bad, ask your Q, someone will
answer. Yes he is right !!!. Funny thing is that it is hard to convince
smart people that they are doing something wrong. Because, they know they
are doing wrong, and it is purely intentional. Stupid ones are simple to
handle !!

-prokash
----- Original Message -----
From: “Alexey Logachyov”
To: “File Systems Developers”
Sent: Saturday, August 30, 2003 2:24 PM
Subject: [ntfsd] Re: Tony,please.Question about Reference Counting art icle
in NT Insider?

> Saying that ANY filter in the stack can cause Mm/Cc to grab a reference to
> the file object doesn’t mean that it will do that. If this really was a
very
> big problem MS would fix I/O Manager behaviou r. FSFDs were written for
many
> years without using IoCancelFileOpen and without knowing about this bug
(or
> whatever you call it). I understand that it is always a good idea to
follow
> MS/OSR documentation/recommendations. But ill drivers still often appear
on
> the market. And you can do nothing to change that. Perhaps, you can make
> your customers use or not use this or that software. I can’t nor want to
do
> that. So, if there is some other filter driver installed which interferes
> with mine, I fix mine.
>
> P.S. There was ‘you’ there because that is how I say it in my language.
This
> list is international. People from many different countries are reading
this
> list. Every language has its own pecularities and it is often difficult if
> not impossible to correlate structures from native language with ones from
> English. Many people for whom English is native language forget about
those
> people from other countries. Reading the last flame in ntdev list on open
> sources is a torture. People, could you be a litle bit simplier in your
> words? We all have to be tolerant to each other. Otherwise our community
is
> worth nothing.
>
> -htfv
>
>
>
> ----- Original Message -----
> From: “Nick Ryan”
> Newsgroups: ntfsd
> To: “File Systems Developers”
> Sent: Saturday, August 30, 2003 11:00 PM
> Subject: [ntfsd] Re: Tony,please.Question about Reference Counting art
icle
> in NT Insider?
>
>
> > There is no ‘you’ here. ANY filter in the stack can cause Mm or Cc to
> > grab a reference to the file object by performing side requests using
> > the file object. The only way to guard against this by derefencing the
> > file object using ObDereferenceObject (not by throwing down a close),
> > and in addition to only use a stream file object allocated by the filter
> > itself, not the file object in the stack.
> >
> > Alexey Logachyov wrote:
> >
> > > Right, the problem was found. But this is the problem when you
> initialize
> > > caching. If don’t intialize cache you may implement your code as
usual.
> This
> > > thread is not about it. The original poster described scenario when
> passing
> > > IRP_MJ_CREATE IRP to lower driver may cause receiving recursive
> IRP_MJ_CLOSE
> > > IRP (as I believed), which is quite possible.
> > >
> > > -htfv
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: “Nick Ryan”
> > > Newsgroups: ntfsd
> > > To: “File Systems Developers”
> > > Sent: Saturday, August 30, 2003 8:31 PM
> > > Subject: [ntfsd] Re: Tony,please.Question about Reference Counting art
> icle
> > > in NT Insider?
> > >
> > >
> > >
> > >>But the problem that’s been found is that other filter drivers may do
> > >>something to initialize the cache (like a non-cached read/write) even
> > >>for a simple open/close.
> > >>
> > >>Alexey Logachyov wrote:
> > >>
> > >>
> > >>>>Imagine we use your scenario, but that second IRP is for a query
> > >>>
> > >>>information
> > >>>
> > >>>
> > >>>>call. In that case, the I/O Manager allocates the file object on
the
> > >>>
> > >>>stack.
> > >>>
> > >>>
> > >>>>Since this is the FIRST file object to be used for I/O, it backs the
> > >>>
> > >>>section
> > >>>
> > >>>
> > >>>>object. That leads to horrible problems because it is not a REAL
file
> > >>>>object, but has now been used to back the section object.
> > >>>
> > >>>
> > >>>>So, I argue that your model is defective on the surface because it
> > >>>
> > >>>wouldn’t
> > >>>
> > >>>
> > >>>>work without reference counting. Thus, I don’t think we need to
make
> an
> > >>>>already defective model work.
> > >>>
> > >>>
> > >>>If the file object is only opened and closed immediately (for example
> to
> > >>>determine whether file exists or not, or whether this is a directory)
> or
> > >>>only used for some query info requests, caching will not be
> initialized,
> > >>>then it means that Cc will not hold any reference to the file object,
> > >
> > > then
> > >
> > >>>it means that this scenario may work.
> > >>>
> > >>>-htfv
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>
> > >>–
> > >>Nick Ryan (MVP for DDK)
> > >>
> > >>
> > >>—
> > >>You are currently subscribed to ntfsd as: xxxxx@vba.com.by
> > >>To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >>
> > >>
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > –
> > Nick Ryan (MVP for DDK)
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@vba.com.by
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
>
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@garlic.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

I ask Tony,just because I read the article from NT Insider,and Tony just
work for OSR.
So,I think Tony is correct man can give me some hints.That’s all.
I’m sorry for my newbie’s behavior.And of course,I want to communicate
with anyone.In my country,ask a particular person to help,is a simply way
to get particular help.And It’s common.

I’m in this list.and I get others’ reply and reply others’ question I can
clarify.
This is the way from the newbie to the senior.
And when I send my message at this list first,Nick tell me that I must
quote original message.
I’m sorry for my mistake and accept this suggestion.Thank you again,Nick.
This is the way the newbie get more experience for rules of communication.
Yes,I’m a newbie.So,I maybe don’t know some rules.I Accepte the suggestion
from anyone.
Prokash Sinha,I’m sorry for my mistake.And I have knowed the rules.Thank
you.

One thing I dont understand why someone has to bitch about others. I’m
certainly sick of this list. Quite frankly, the cut and paste technology was
first started with windows. MS recommended it. Use the examples, take some
boiler plate code and twick it to your need… Then there is flod of tech
books, with all kinds of examples. Quite often, younger ones need some
information, they hardly know the caveots of copyright(wrong) or copyleft
whatever anyone thinks about it. So they look upto the big guys for
information, so that they can get the job done. BUT THAT DOES NOT GIVE
ANYONE RIGHT TO SAY, I’M HELPING THEM TO FEED THEIR FAMILY. Complete
shithead in my opinion. They never came to beg a particular person, pls help
me. You are someone extend your hand, then comearound to say such things.
God!, unbelivable.

About a year or so ago, I saw the same thing, I mentioned about it, Dan
Partley(spell error !) said, it is not that bad, ask your Q, someone will
answer. Yes he is right !!!. Funny thing is that it is hard to convince
smart people that they are doing something wrong. Because, they know they
are doing wrong, and it is purely intentional. Stupid ones are simple to
handle !!

-prokash