2012-03-24 16:40:26

by Matt W. Benjamin

[permalink] [raw]
Subject: unlink within an open directory stream

Hi,

Folks testing linux nfs + Ganesha with bonnie++ have noticed the issue described here (but I didn't see traffic on this list):

http://bugs.centos.org/view.php?id=5496
https://bugzilla.redhat.com/show_bug.cgi?id=789452

Ie, an application which unlinks on an open (nfs) directory stream, and continues to read and unlink progressively, will generally not see all the entries originally in the stream. Reopening the stream ives the "correct" result. So, apparently older clients were more forgiving, as mentioned in the links. Is the current behavior one the client is intending?

Thanks,

Matt

--
Matt Benjamin
The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI 48104

http://linuxbox.com

tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309


2012-03-30 20:17:49

by Jeff Layton

[permalink] [raw]
Subject: Re: unlink within an open directory stream

On Mon, 26 Mar 2012 11:17:18 -0700
Boaz Harrosh <[email protected]> wrote:

> On 03/24/2012 10:12 AM, Myklebust, Trond wrote:
>
> > On Sat, 2012-03-24 at 12:53 -0400, Matt W. Benjamin wrote:
> >> Hi,
> >>
> >> I don't think anything is. Or, people originally reported the behavior against knfsd.
> >>
> >> Matt
> >
> > There is a known issue with ext2/3/4 generating non-unique readdir
> > cookies. It rarely hits you when you are creating small directories, but
> > it frequently hits you with larger ones. A fix is underway that should
> > significantly reduce the frequency of cookie collisions.
> >
> > Recent NFS clients will actually detect the presence of those cookie
> > loops, and log them in the kernel syslog. That would therefore be the
> > first thing that I'd check if confronted with this kind of problem.
> >
> > Cheers
> > Trond
> >
>
>
> Trond please look on the bug report links below. It's not the "cookie collisions" case.
>
> It's the new (post RHEL 6.0 Kernel) NFS need for opendir after an unlink.
> Now the POSIX man page *does* say that applications must re-opendir after
> unlink, but there are some applications who did not read the manual, and since
> it works with local filesystems and old nfs, (What Kernel RHEL 6.0 is based on?)
> they never noticed the bug and never fixed it.
>

The RHEL6 kernel is 2.6.32 based, but we have (as always) done some
fairly extensive backports from upstream.

One of the things that was backported was the Bryan's work to clean up
readdir and to eliminate the readdirplus limit. With that change, you
get fewer entries per READDIRPLUS call, so you make more READDIRPLUS
calls to the server in order to traverse an entire directory.

Since you're unlinking as you go, then I suspect that you're just more
likely to see this problem crop up, but I suspect Trond is correct and
this is preexisting bug.

One way to confirm this might be to have them mount with -o nordirplus.
Does that make the problem go away?
--
Jeff Layton <[email protected]>

2012-03-30 17:11:19

by Matt W. Benjamin

[permalink] [raw]
Subject: Re: unlink within an open directory stream

Hi,

Thanks for providing all this reasoning and additional background.

I guess I've always constructed an imaginary intention of the protocol feature that's different from the actual one. Yet the feature nevertheless seemed useful.

There seem to be two parts to my construction:

1. negatively, it never occurred to me that a client implementation would assume that it could protect an application from invalidation, unless it was able to perform, and cache a complete traversal--this would be one with a consistent verifier for all component readdirs

2. at the same time, it seems a conforming server implementation can be made which would often support a client in doing this, presuming it was able to use the cookie verifier to select a prior version of the directory; not only do some filesystems now appear able to do this, this technique is used by the dcache nfs server, though iiuc, dcache doesn't make any promises that it will have a specific component cached at every version, etc

Matt

----- "Trond Myklebust" <[email protected]> wrote:

> On Fri, 2012-03-30 at 11:24 -0400, Peter Staubach wrote:
> > Yes, hmmm, ummm...
> >
> > A long time, I thought that the readdir cookie verifier sounded like
> a good idea. After all, if directories can be compacted, it would be
> nice to be able to tell when the cookie has become invalid, right?
> So, I added it to the NFSv3 protocol.
> >
> > It was only afterwards, in attempting to implement it, that the real
> truth was discovered. This is that the interfaces are not sufficient
> to be able to convey this information sufficiently and to be able to
> recover from the situation. Currently, recovery require action on the
> part of the application.
> >
> > In retrospect, I wouldn't add the cookie verifier if I was doing it
> again.
> >
> > Thanks for the support, though. :-)
> >
> > I do disagree with Trond though, in that applications must be coded
> to be able to handle directories where cookies can become invalidated.
> That's why rm and such have to be coded to keep track of their
> location in the directory by more than just d_off.
>
> The problem with that is that there is no standard for how
> applications
> should proceed to do this, and so there are no guidelines for how the
> client should behave.
>
> Worse, if you've looked at the glibc readdir library code, you'll
> have
> noticed that it _depends_ on being able to use a strictly
> POSIX-conforming version of telldir()/seekdir(). If it can't rewind to
> a
> previously saved offset, then it can end up skipping entries.
>
> So no, I can't rely on applications either...
>
> > ps
> >
> >
> > -----Original Message-----
> > From: [email protected]
> [mailto:[email protected]] On Behalf Of Matt W.
> Benjamin
> > Sent: Monday, March 26, 2012 2:55 PM
> > To: Boaz Harrosh
> > Cc: linux-nfs; Ganesha NFS List; Trond Myklebust
> > Subject: Re: unlink within an open directory stream
> >
> > Hi,
> >
> > Boaz: we do not any longer send a readdir index. We do send a
> cookieverf.
> >
> > Fist of all, I haven't established that the issue we're actually
> observing is caused by the Linux client sending old cookies to
> readdir(something). However, if it is, it's in no way better to try
> to make cookies "more persistent." Nor should the Linux client be
> expecting it. The assumption is simply flawed. The protocol
> introduced cookie verifier (a LONG time ago) for a reason.
> >
> > Matt
> > ----- "Boaz Harrosh" <[email protected]> wrote:
> >
> > > On 03/26/2012 11:25 AM, Myklebust, Trond wrote:
> > >
> > > > On Mon, 2012-03-26 at 11:17 -0700, Boaz Harrosh wrote:
> > > >> On 03/24/2012 10:12 AM, Myklebust, Trond wrote:
> > > >>
> > > >>
> > > >> It's the new (post RHEL 6.0 Kernel) NFS need for opendir after
> an
> > > unlink.
> > > >
> > > > What?
> > > >
> > >
> > >
> > > The links below report on regression in RHEL 6.2 which have a new
> NFS
> > > implementation where 6.0 used to be fine.
> > > (Or it's what I understood from the reporters)
> > >
> > > <snip>
> > >
> > > >
> > >
> > > > No.
> > > >
> > > > If the server supports permanent readdir cookies, then there is
> no
> > > need
> > > > for opendir after unlink.
> > > >
> > > > If the server does not have permanent readdir cookies, then our
> > > client
> > > > has never supported it anyway (nor will it ever do so). That
> whole
> > > > 'cookieverf' READDIR bullshit has never provided a workable
> model
> > > for a
> > > > POSIX client...
> > >
> > >
> > > Thanks Trond for the explanation. Forgive my slowness. So you are
>
> > > saying that with knfsd it's actually filesystem dependent and
> maybe
> > > the reporters did not compare apples-to-apples and the difference
> is
> > > in the behind file system.
> > >
> > > Matt I'm sure Trond is right with regard to Ganesha, because we
> send a
> > > readdir index and a cookieverf, which will change after unlink.
> Since
> > > the application does not call opendir again the client will send
> the
> > > old cookies, which is now a different file or might get
> out-of-bounds
> > > for Ganesha.
> > >
> > > Let me think about it a bit. I'm sure we can send a Better 64bit
> > > cookie, which will be more persistent, even across unlinks.
> > >
> > > >
> > > >
> > >
> > >
> > > Thanks
> > > Boaz
> >
> > --
> > Matt Benjamin
> > The Linux Box
> > 206 South Fifth Ave. Suite 150
> > Ann Arbor, MI 48104
> >
> > http://linuxbox.com
> >
> > tel. 734-761-4689
> > fax. 734-769-8938
> > cel. 734-216-5309
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-nfs"
> in the body of a message to [email protected] More majordomo
> info at http://vger.kernel.org/majordomo-info.html
>
> --
> Trond Myklebust
> Linux NFS client maintainer
>
> NetApp
> [email protected]
> http://www.netapp.com

--
Matt Benjamin
The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI 48104

http://linuxbox.com

tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309

2012-03-26 18:17:50

by Boaz Harrosh

[permalink] [raw]
Subject: Re: unlink within an open directory stream

On 03/24/2012 10:12 AM, Myklebust, Trond wrote:

> On Sat, 2012-03-24 at 12:53 -0400, Matt W. Benjamin wrote:
>> Hi,
>>
>> I don't think anything is. Or, people originally reported the behavior against knfsd.
>>
>> Matt
>
> There is a known issue with ext2/3/4 generating non-unique readdir
> cookies. It rarely hits you when you are creating small directories, but
> it frequently hits you with larger ones. A fix is underway that should
> significantly reduce the frequency of cookie collisions.
>
> Recent NFS clients will actually detect the presence of those cookie
> loops, and log them in the kernel syslog. That would therefore be the
> first thing that I'd check if confronted with this kind of problem.
>
> Cheers
> Trond
>


Trond please look on the bug report links below. It's not the "cookie collisions" case.

It's the new (post RHEL 6.0 Kernel) NFS need for opendir after an unlink.
Now the POSIX man page *does* say that applications must re-opendir after
unlink, but there are some applications who did not read the manual, and since
it works with local filesystems and old nfs, (What Kernel RHEL 6.0 is based on?)
they never noticed the bug and never fixed it.

Could we easily support the broken application by being bug compatible to
old NFS versions?
.i.e Don't require re-opendir after unlink of a file.

There are more examples in the bug reports below but basically bonnie++
does the following:
DIR *d = opendir(".");
dirent *file_ent;
while((file_ent = readdir(d)) != NULL) {
unlink( file_ent->d_name))
}
closedir(d);

where it actually needs to do:

DIR *d = opendir(".");
dirent *file_ent;
while((file_ent = readdir(d)) != NULL) {
unlink( file_ent->d_name))

closedir(d);
d = opendir(".");
}
closedir(d);

But again case one used to work with old NFS. And it looks like
it is not Server dependent. We saw this both with Ganesha as well
as knfsd

<snip>

>> http://bugs.centos.org/view.php?id=5496
>> https://bugzilla.redhat.com/show_bug.cgi?id=789452

Thanks
Boaz

2012-03-24 16:53:56

by Matt W. Benjamin

[permalink] [raw]
Subject: Re: unlink within an open directory stream

Hi,

I don't think anything is. Or, people originally reported the behavior against knfsd.

Matt

----- "Trond Myklebust" <[email protected]> wrote:

> On Sat, 2012-03-24 at 12:34 -0400, Matt W. Benjamin wrote:
> > Hi,
> >
> > Folks testing linux nfs + Ganesha with bonnie++ have noticed the
> issue described here (but I didn't see traffic on this list):
> >
> > http://bugs.centos.org/view.php?id=5496
> > https://bugzilla.redhat.com/show_bug.cgi?id=789452
> >
> > Ie, an application which unlinks on an open (nfs) directory stream,
> and continues to read and unlink progressively, will generally not see
> all the entries originally in the stream. Reopening the stream ives
> the "correct" result. So, apparently older clients were more
> forgiving, as mentioned in the links. Is the current behavior one the
> client is intending?
> >
> > Thanks,
> >
> > Matt
>
> What is so particular about the ganesha readdir implementation?
>
> --
> Trond Myklebust
> Linux NFS client maintainer
>
> NetApp
> [email protected]
> http://www.netapp.com

--
Matt Benjamin
The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI 48104

http://linuxbox.com

tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309

2012-03-26 19:01:15

by Myklebust, Trond

[permalink] [raw]
Subject: Re: unlink within an open directory stream

T24gTW9uLCAyMDEyLTAzLTI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hbmVzaGEgYXMgd2VsbA0KPiBhcyBrbmZzZA0KDQpOby4NCg0KSWYgdGhlIHNlcnZlciBz
dXBwb3J0cyBwZXJtYW5lbnQgcmVhZGRpciBjb29raWVzLCB0aGVuIHRoZXJlIGlzIG5vIG5lZWQN
CmZvciBvcGVuZGlyIGFmdGVyIHVubGluay4NCg0KSWYgdGhlIHNlcnZlciBkb2VzIG5vdCBoYXZl
IHBlcm1hbmVudCByZWFkZGlyIGNvb2tpZXMsIHRoZW4gb3VyIGNsaWVudA0KaGFzIG5ldmVyIHN1
cHBvcnRlZCBpdCBhbnl3YXkgKG5vciB3aWxsIGl0IGV2ZXIgZG8gc28pLiBUaGF0IHdob2xlDQon
Y29va2lldmVyZicgUkVBRERJUiBidWxsc2hpdCBoYXMgbmV2ZXIgcHJvdmlkZWQgYSB3b3JrYWJs
ZSBtb2RlbCBmb3IgYQ0KUE9TSVggY2xpZW50Li4uDQoNCg0KLS0gDQpUcm9uZCBNeWtsZWJ1c3QN
CkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0KDQpOZXRBcHANClRyb25kLk15a2xlYnVzdEBu
ZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0KDQo=

2012-03-24 17:43:43

by Matt W. Benjamin

[permalink] [raw]
Subject: Re: unlink within an open directory stream

Hi,

Thanks. I'm pretty sure that's not happening (haven't seen any such message from Linux 3.3.0-rc7, for example), but I'll retest.

Matt

----- "Trond Myklebust" <[email protected]> wrote:

--
Matt Benjamin
The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI 48104

http://linuxbox.com

tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309

2012-03-24 16:45:08

by Myklebust, Trond

[permalink] [raw]
Subject: Re: unlink within an open directory stream

T24gU2F0LCAyMDEyLTAzLTI0IGF0IDEyOjM0IC0wNDAwLCBNYXR0IFcuIEJlbmphbWluIHdyb3Rl
Og0KPiBIaSwNCj4gDQo+IEZvbGtzIHRlc3Rpbmcg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26 18:44:01

by Boaz Harrosh

[permalink] [raw]
Subject: Re: unlink within an open directory stream

On 03/26/2012 11:25 AM, Myklebust, Trond wrote:

> On Mon, 2012-03-26 at 11:17 -0700, Boaz Harrosh wrote:
>> On 03/24/2012 10:12 AM, Myklebust, Trond wrote:
>>
>>
>> It's the new (post RHEL 6.0 Kernel) NFS need for opendir after an unlink.
>
> What?
>


The links below report on regression in RHEL 6.2 which have a new NFS
implementation where 6.0 used to be fine.
(Or it's what I understood from the reporters)

<snip>

>

> No.
>
> If the server supports permanent readdir cookies, then there is no need
> for opendir after unlink.
>
> If the server does not have permanent readdir cookies, then our client
> has never supported it anyway (nor will it ever do so). That whole
> 'cookieverf' READDIR bullshit has never provided a workable model for a
> POSIX client...


Thanks Trond for the explanation. Forgive my slowness. So you are
saying that with knfsd it's actually filesystem dependent and maybe
the reporters did not compare apples-to-apples and the difference is
in the behind file system.

Matt I'm sure Trond is right with regard to Ganesha, because we
send a readdir index and a cookieverf, which will change after
unlink. Since the application does not call opendir again the
client will send the old cookies, which is now a different file
or might get out-of-bounds for Ganesha.

Let me think about it a bit. I'm sure we can send a Better
64bit cookie, which will be more persistent, even across unlinks.

>
>


Thanks
Boaz

2012-03-26 19:29:50

by Matt W. Benjamin

[permalink] [raw]
Subject: Re: unlink within an open directory stream

Hi,

----- "Trond Myklebust" <[email protected]> wrote:

> On Mon, 2012-03-26 at 14:55 -0400, Matt W. Benjamin wrote:
> > Hi,
> >
> > Boaz: we do not any longer send a readdir index. We do send a
> cookieverf.
>
> Uhh... That would be so broken, that I can't imagine that is true...

I think you're misreading my statement. My intended meaning had to do with Ganesha's generator
for the cookies themselves. It's not relevant.

>
> > Fist of all, I haven't established that the issue we're actually
> observing is caused
> > by the Linux client sending old cookies to readdir(something).
> However, if it is,
> > it's in no way better to try to make cookies "more persistent." Nor
> should the Linux
> > client be expecting it. The assumption is simply flawed. The
> protocol introduced
> > cookie verifier (a LONG time ago) for a reason.
>
> Bullshit... The cookie verifier is unimplementable. Feel free to try
> or
> to show me an implementation that works. However I refuse to waste
> any
> more of my time trying to make that crap work, having already wasted
> several months of my life doing just that.

There must be something I'm missing here, but ok.

>
> --
> Trond Myklebust
> Linux NFS client maintainer
>
> NetApp
> [email protected]
> http://www.netapp.com

--
Matt Benjamin
The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI 48104

http://linuxbox.com

tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309

2012-03-24 17:12:46

by Myklebust, Trond

[permalink] [raw]
Subject: Re: unlink within an open directory stream

T24gU2F0LCAyMDEyLTAzLTI0IGF0IDEyOjUzIC0wNDAwLCBNYXR0IFcuIEJlbmphbWluIHdyb3Rl
Og0KPiBIaSwNCj4gDQo+IEkgZG9uJ3QgdGhpbmsgYW55dGhpbmcgaXMuICBPciwgcGVvcGxlIG9y
aWdpbmFsbHkgcmVwb3J0ZWQgdGhlIGJlaGF2aW9yIGFnYWluc3Qga25mc2QuDQo+IA0KPiBNYXR0
DQoNClRoZXJlIGlzIGEga25vd24gaXNzdWUgd2l0aCBleHQyLzMvNCBnZW5lcmF0aW5nIG5vbi11
bmlxdWUgcmVhZGRpcg0KY29va2llcy4gSXQgcmFyZWx5IGhpdHMgeW91IHdoZW4geW91IGFyZSBj
cmVhdGluZyBzbWFsbCBkaXJlY3RvcmllcywgYnV0DQppdCBmcmVxdWVudGx5IGhpdHMgeW91IHdp
dGggbGFyZ2VyIG9uZXMuIEEgZml4IGlzIHVuZGVyd2F5IHRoYXQgc2hvdWxkDQpzaWduaWZpY2Fu
dGx5IHJlZHVjZSB0aGUgZnJlcXVlbmN5IG9mIGNvb2tpZSBjb2xsaXNpb25zLg0KDQpSZWNlbnQg
TkZTIGNsaWVudHMgd2lsbCBhY3R1YWxseSBkZXRlY3QgdGhlIHByZXNlbmNlIG9mIHRob3NlIGNv
b2tpZQ0KbG9vcHMsIGFuZCBsb2cgdGhlbSBpbiB0aGUga2VybmVsIHN5c2xvZy4gVGhhdCB3b3Vs
ZCB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BhcmVudGx5IG9sZGVyIGNsaWVu
dHMgd2VyZSBtb3JlDQo+ID4gZm9yZ2l2aW5nLCBhcyBtZW50aW9uZWQgaW4gdGhlIGxpbmtzLiAg
SXMgdGhlIGN1cnJlbnQgYmVoYXZpb3Igb25lIHRoZQ0KPiA+IGNsaWVudCBpcyBpbnRlbmRpbmc/
DQo+ID4gPiANCj4gPiA+IFRoYW5rcywNCj4gPiA+IA0KPiA+ID4gTWF0dA0KPiA+IA0KPiA+IFdo
YXQgaXMgc28gcGFydGljdWxhciBhYm91dCB0aGUgZ2FuZXNoYSByZWFkZGlyIGltcGxlbWVudGF0
aW9uPw0KPiA+IA0KPiA+IC0tIA0KPiA+IFRyb25kIE15a2xlYnVzdA0KPiA+IExpbnV4IE5GUyBj
bGllbnQgbWFpbnRhaW5lcg0KPiA+IA0KPiA+IE5ldEFwcA0KPiA+IFRyb25kLk15a2xlYnVzdEBu
ZXRhcHAuY29tDQo+ID4gd3d3Lm5ldGFwcC5jb20NCj4gDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0
DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RA
bmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg0K

2012-03-26 19:07:54

by Boaz Harrosh

[permalink] [raw]
Subject: Re: unlink within an open directory stream

On 03/26/2012 11:55 AM, Matt W. Benjamin wrote:

> Hi,
>
> Boaz: we do not any longer send a readdir index. We do send a cookieverf.
>
> Fist of all, I haven't established that the issue we're actually observing is caused
> by the Linux client sending old cookies to readdir(something). However, if it is,
> it's in no way better to try to make cookies "more persistent." Nor should the Linux
> client be expecting it. The assumption is simply flawed. The protocol introduced
> cookie verifier (a LONG time ago) for a reason.
>
> Matt


Please don't top-post in a Linux-mailing lists. Us Linux guys are not used to it
and get confused.

Regarding the cookie-verifier it looks like the Linux client never supported
that. So even if it will start to, from here on, we are in trouble with old
clients.

Since we are in the business of being bug backward compatible then fixing the
client will not help. Because you must agree the easiest is to fix bonnie++
but that's a privilege we do not have.

I think we should imitate the behavior of knfsd+exfs3 I'm sure it's easy for
Ganesha to fix it. Lets talk about it in this week call. I have ideas that
will not change current code, just a small enhancement.

Thanks
Boaz

> ----- "Boaz Harrosh" <[email protected]> wrote:
>
>> On 03/26/2012 11:25 AM, Myklebust, Trond wrote:
>>
>>> On Mon, 2012-03-26 at 11:17 -0700, Boaz Harrosh wrote:
>>>> On 03/24/2012 10:12 AM, Myklebust, Trond wrote:
>>>>
>>>>
>>>> It's the new (post RHEL 6.0 Kernel) NFS need for opendir after an
>> unlink.
>>>
>>> What?
>>>
>>
>>
>> The links below report on regression in RHEL 6.2 which have a new NFS
>> implementation where 6.0 used to be fine.
>> (Or it's what I understood from the reporters)
>>
>> <snip>
>>
>>>
>>
>>> No.
>>>
>>> If the server supports permanent readdir cookies, then there is no
>> need
>>> for opendir after unlink.
>>>
>>> If the server does not have permanent readdir cookies, then our
>> client
>>> has never supported it anyway (nor will it ever do so). That whole
>>> 'cookieverf' READDIR bullshit has never provided a workable model
>> for a
>>> POSIX client...
>>
>>
>> Thanks Trond for the explanation. Forgive my slowness. So you are
>> saying that with knfsd it's actually filesystem dependent and maybe
>> the reporters did not compare apples-to-apples and the difference is
>> in the behind file system.
>>
>> Matt I'm sure Trond is right with regard to Ganesha, because we
>> send a readdir index and a cookieverf, which will change after
>> unlink. Since the application does not call opendir again the
>> client will send the old cookies, which is now a different file
>> or might get out-of-bounds for Ganesha.
>>
>> Let me think about it a bit. I'm sure we can send a Better
>> 64bit cookie, which will be more persistent, even across unlinks.
>>
>>>
>>>
>>
>>
>> Thanks
>> Boaz
>



2012-03-30 16:59:53

by Peter Staubach

[permalink] [raw]
Subject: RE: unlink within an open directory stream

UHJlY2lzZWx5LCBUcm9uZCEgIDotKQ0KDQpUaGF0J3Mgd2h5IHRoZSBjb29raWUgdmVyaWZpZXIg
dHVybmVkIG91dCB0byBiZSBhIHVudGVuYWJsZ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Y2FuIHNlbmQgYSBCZXR0ZXIgNjRiaXQgDQo+ID4gY29va2llLCB3aGljaCB3
aWxsIGJlIG1vcmUgcGVyc2lzdGVudCwgZXZlbiBhY3Jvc3MgdW5saW5rcy4NCj4gPiANCj4gPiA+
IA0KPiA+ID4gDQo+ID4gDQo+ID4gDQo+ID4gVGhhbmtzDQo+ID4gQm9heg0KPiANCj4gLS0NCj4g
TWF0dCBCZW5qYW1pbg0KPiBUaGUgTGludXggQm94DQo+IDIwNiBTb3V0aCBGaWZ0aCBBdmUuIFN1
aXRlIDE1MA0KPiBBbm4gQXJib3IsIE1JICA0ODEwNA0KPiANCj4gaHR0cDovL2xpbnV4Ym94LmNv
bQ0KPiANCj4gdGVsLiA3MzQtNzYxLTQ2ODkNCj4gZmF4LiA3MzQtNzY5LTg5MzgNCj4gY2VsLiA3
MzQtMjE2LTUzMDkNCj4gLS0NCj4gVG8gdW5zdWJzY3JpYmUgZnJvbSB0aGlzIGxpc3Q6IHNlbmQg
dGhlIGxpbmUgInVuc3Vic2NyaWJlIGxpbnV4LW5mcyIgDQo+IGluIHRoZSBib2R5IG9mIGEgbWVz
c2FnZSB0byBtYWpvcmRvbW9Admdlci5rZXJuZWwub3JnIE1vcmUgbWFqb3Jkb21vIA0KPiBpbmZv
IGF0ICBodHRwOi8vdmdlci5rZXJuZWwub3JnL21ham9yZG9tby1pbmZvLmh0bWwNCg0KLS0NClRy
b25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVudCBtYWludGFpbmVyDQoNCk5ldEFwcA0KVHJv
bmQuTXlrbGVidXN0QG5ldGFwcC5jb20NCnd3dy5uZXRhcHAuY29tDQoNCg==

2012-03-26 18:55:24

by Matt W. Benjamin

[permalink] [raw]
Subject: Re: unlink within an open directory stream

Hi,

Boaz: we do not any longer send a readdir index. We do send a cookieverf.

Fist of all, I haven't established that the issue we're actually observing is caused
by the Linux client sending old cookies to readdir(something). However, if it is,
it's in no way better to try to make cookies "more persistent." Nor should the Linux
client be expecting it. The assumption is simply flawed. The protocol introduced
cookie verifier (a LONG time ago) for a reason.

Matt
----- "Boaz Harrosh" <[email protected]> wrote:

> On 03/26/2012 11:25 AM, Myklebust, Trond wrote:
>
> > On Mon, 2012-03-26 at 11:17 -0700, Boaz Harrosh wrote:
> >> On 03/24/2012 10:12 AM, Myklebust, Trond wrote:
> >>
> >>
> >> It's the new (post RHEL 6.0 Kernel) NFS need for opendir after an
> unlink.
> >
> > What?
> >
>
>
> The links below report on regression in RHEL 6.2 which have a new NFS
> implementation where 6.0 used to be fine.
> (Or it's what I understood from the reporters)
>
> <snip>
>
> >
>
> > No.
> >
> > If the server supports permanent readdir cookies, then there is no
> need
> > for opendir after unlink.
> >
> > If the server does not have permanent readdir cookies, then our
> client
> > has never supported it anyway (nor will it ever do so). That whole
> > 'cookieverf' READDIR bullshit has never provided a workable model
> for a
> > POSIX client...
>
>
> Thanks Trond for the explanation. Forgive my slowness. So you are
> saying that with knfsd it's actually filesystem dependent and maybe
> the reporters did not compare apples-to-apples and the difference is
> in the behind file system.
>
> Matt I'm sure Trond is right with regard to Ganesha, because we
> send a readdir index and a cookieverf, which will change after
> unlink. Since the application does not call opendir again the
> client will send the old cookies, which is now a different file
> or might get out-of-bounds for Ganesha.
>
> Let me think about it a bit. I'm sure we can send a Better
> 64bit cookie, which will be more persistent, even across unlinks.
>
> >
> >
>
>
> Thanks
> Boaz

--
Matt Benjamin
The Linux Box
206 South Fifth Ave. Suite 150
Ann Arbor, MI 48104

http://linuxbox.com

tel. 734-761-4689
fax. 734-769-8938
cel. 734-216-5309

2012-03-30 15:47:45

by Myklebust, Trond

[permalink] [raw]
Subject: RE: unlink within an open directory stream

T24gRnJpLCAyMDEyLTAzLTMwIGF0IDExOjI0IC0wNDAwLCBQZXRlciBTdGF1YmFjaCB3cm90ZToN
Cj4gWWVzLCBobW1tLCB1bW1tLi4uDQo+IA0KPiBBIGxvbmcgdGltZSwgSSB0aG91Z2h0IHRoYXQg
dGhlIHJlYWRkaXIg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hbiBzZW5kIGEgQmV0dGVy
IDY0Yml0IA0KPiBjb29raWUsIHdoaWNoIHdpbGwgYmUgbW9yZSBwZXJzaXN0ZW50LCBldmVuIGFj
cm9zcyB1bmxpbmtzLg0KPiANCj4gPiANCj4gPiANCj4gDQo+IA0KPiBUaGFua3MNCj4gQm9heg0K
DQotLQ0KTWF0dCBCZW5qYW1pbg0KVGhlIExpbnV4IEJveA0KMjA2IFNvdXRoIEZpZnRoIEF2ZS4g
U3VpdGUgMTUwDQpBbm4gQXJib3IsIE1JICA0ODEwNA0KDQpodHRwOi8vbGludXhib3guY29tDQoN
CnRlbC4gNzM0LTc2MS00Njg5DQpmYXguIDczNC03NjktODkzOA0KY2VsLiA3MzQtMjE2LTUzMDkN
Ci0tDQpUbyB1bnN1YnNjcmliZSBmcm9tIHRoaXMgbGlzdDogc2VuZCB0aGUgbGluZSAidW5zdWJz
Y3JpYmUgbGludXgtbmZzIiBpbiB0aGUgYm9keSBvZiBhIG1lc3NhZ2UgdG8gbWFqb3Jkb21vQHZn
ZXIua2VybmVsLm9yZyBNb3JlIG1ham9yZG9tbyBpbmZvIGF0ICBodHRwOi8vdmdlci5rZXJuZWwu
b3JnL21ham9yZG9tby1pbmZvLmh0bWwNCg==

2012-04-04 15:35:06

by Jeff Layton

[permalink] [raw]
Subject: Re: unlink within an open directory stream

On Mon, 26 Mar 2012 11:17:18 -0700
Boaz Harrosh <[email protected]> wrote:

> On 03/24/2012 10:12 AM, Myklebust, Trond wrote:
>
> > On Sat, 2012-03-24 at 12:53 -0400, Matt W. Benjamin wrote:
> >> Hi,
> >>
> >> I don't think anything is. Or, people originally reported the behavior against knfsd.
> >>
> >> Matt
> >
> > There is a known issue with ext2/3/4 generating non-unique readdir
> > cookies. It rarely hits you when you are creating small directories, but
> > it frequently hits you with larger ones. A fix is underway that should
> > significantly reduce the frequency of cookie collisions.
> >
> > Recent NFS clients will actually detect the presence of those cookie
> > loops, and log them in the kernel syslog. That would therefore be the
> > first thing that I'd check if confronted with this kind of problem.
> >
> > Cheers
> > Trond
> >
>
>
> Trond please look on the bug report links below. It's not the "cookie collisions" case.
>
> It's the new (post RHEL 6.0 Kernel) NFS need for opendir after an unlink.
> Now the POSIX man page *does* say that applications must re-opendir after
> unlink, but there are some applications who did not read the manual, and since
> it works with local filesystems and old nfs, (What Kernel RHEL 6.0 is based on?)
> they never noticed the bug and never fixed it.
>

^^^^^
Can you tell me which manpage says this? I'd like to be able to point
application developers at it if possible...

> Could we easily support the broken application by being bug compatible to
> old NFS versions?
> .i.e Don't require re-opendir after unlink of a file.
>
> There are more examples in the bug reports below but basically bonnie++
> does the following:
> DIR *d = opendir(".");
> dirent *file_ent;
> while((file_ent = readdir(d)) != NULL) {
> unlink( file_ent->d_name))
> }
> closedir(d);
>
> where it actually needs to do:
>
> DIR *d = opendir(".");
> dirent *file_ent;
> while((file_ent = readdir(d)) != NULL) {
> unlink( file_ent->d_name))
>
> closedir(d);
> d = opendir(".");
> }
> closedir(d);
>
> But again case one used to work with old NFS. And it looks like
> it is not Server dependent. We saw this both with Ganesha as well
> as knfsd
>
> <snip>
>

Again, my suspicion is that the change that triggered this is the
switch to use READDIRPLUS on larger directories. Before that, we'd use
READDIR on larger ones and wouldn't need to make as many RPCs to fetch
directory contents. More continuation READDIRPLUS calls means that you
have more opportunity to hit problems with cookies.

What might be an interesting test is to see whether this is still
reproducible on newer clients when you mount with '-o nordirplus'.

Cheers,
--
Jeff Layton <[email protected]>

2012-04-05 08:45:11

by Benny Halevy

[permalink] [raw]
Subject: Re: unlink within an open directory stream

On 2012-04-04 18:35, Jeff Layton wrote:
> On Mon, 26 Mar 2012 11:17:18 -0700
> Boaz Harrosh <[email protected]> wrote:
>
>> On 03/24/2012 10:12 AM, Myklebust, Trond wrote:
>>
>>> On Sat, 2012-03-24 at 12:53 -0400, Matt W. Benjamin wrote:
>>>> Hi,
>>>>
>>>> I don't think anything is. Or, people originally reported the behavior against knfsd.
>>>>
>>>> Matt
>>>
>>> There is a known issue with ext2/3/4 generating non-unique readdir
>>> cookies. It rarely hits you when you are creating small directories, but
>>> it frequently hits you with larger ones. A fix is underway that should
>>> significantly reduce the frequency of cookie collisions.
>>>
>>> Recent NFS clients will actually detect the presence of those cookie
>>> loops, and log them in the kernel syslog. That would therefore be the
>>> first thing that I'd check if confronted with this kind of problem.
>>>
>>> Cheers
>>> Trond
>>>
>>
>>
>> Trond please look on the bug report links below. It's not the "cookie collisions" case.
>>
>> It's the new (post RHEL 6.0 Kernel) NFS need for opendir after an unlink.
>> Now the POSIX man page *does* say that applications must re-opendir after
>> unlink, but there are some applications who did not read the manual, and since
>> it works with local filesystems and old nfs, (What Kernel RHEL 6.0 is based on?)
>> they never noticed the bug and never fixed it.
>>
>
> ^^^^^
> Can you tell me which manpage says this? I'd like to be able to point
> application developers at it if possible...
>

Hmm, http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html says:

files may be removed from a directory or added to a directory asynchronously to the operation of readdir().

...

If a file is removed from or added to the directory after the most recent call to opendir() or rewinddir(), whether a subsequent call to readdir() returns an entry for that file is unspecified.

...

If a file is removed from or added to the directory after the most recent call to opendir() or rewinddir(), whether a subsequent call to readdir_r() returns an entry for that file is unspecified.

Benny

>> Could we easily support the broken application by being bug compatible to
>> old NFS versions?
>> .i.e Don't require re-opendir after unlink of a file.
>>
>> There are more examples in the bug reports below but basically bonnie++
>> does the following:
>> DIR *d = opendir(".");
>> dirent *file_ent;
>> while((file_ent = readdir(d)) != NULL) {
>> unlink( file_ent->d_name))
>> }
>> closedir(d);
>>
>> where it actually needs to do:
>>
>> DIR *d = opendir(".");
>> dirent *file_ent;
>> while((file_ent = readdir(d)) != NULL) {
>> unlink( file_ent->d_name))
>>
>> closedir(d);
>> d = opendir(".");
>> }
>> closedir(d);
>>
>> But again case one used to work with old NFS. And it looks like
>> it is not Server dependent. We saw this both with Ganesha as well
>> as knfsd
>>
>> <snip>
>>
>
> Again, my suspicion is that the change that triggered this is the
> switch to use READDIRPLUS on larger directories. Before that, we'd use
> READDIR on larger ones and wouldn't need to make as many RPCs to fetch
> directory contents. More continuation READDIRPLUS calls means that you
> have more opportunity to hit problems with cookies.
>
> What might be an interesting test is to see whether this is still
> reproducible on newer clients when you mount with '-o nordirplus'.
>
> Cheers,