2003-03-05 02:26:36

by Christopher Li

[permalink] [raw]
Subject: RE: [Ext2-devel] Re: ext3 htree brelse problems look to be fixed!

I post a patch for comment on ext2-devel for the
NFS cookie bug. Did not get any feedback yet.
As Ted suggested, it set the cookie to -1 on EOF,
even though it is not seek able to there.

I only test it with Stephen's "readdir.c".
Not have chance to run it on a NFS server yet.

Do you have more information about the cache trashing
bug?

Regards,
Chris


===== dir.c 1.5 vs edited =====
--- 1.5/fs/ext3/dir.c Wed Oct 2 01:24:11 2002
+++ edited/dir.c Sat Mar 1 23:45:04 2003
@@ -450,8 +450,10 @@
&info->next_hash);
if (ret < 0)
return ret;
- if (ret == 0)
+ if (ret == 0) {
+ filp->f_pos = -1;
break;
+ }
info->curr_node = rb_get_first(&info->root);
}


> -----Original Message-----
> From: Daniel Phillips [mailto:[email protected]]
> Sent: Wednesday, March 05, 2003 12:25 AM
> To: James H. Cloos Jr.; [email protected]
> Cc: [email protected]; [email protected]
> Subject: [Ext2-devel] Re: ext3 htree brelse problems look to be fixed!
>
>
> On Wed 05 Mar 03 00:57, James H. Cloos Jr. wrote:
> > I beleive (with this patch) htree is now ready for prime time.
>
> Good that it's working for you, but it's not quite the last
> issue. There is
> some apparent cache thrashing to track down, and I believe
> there's still an
> outstanding NFS issue. It's getting there, though.
>
> Regards,
>
> Daniel
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Etnus, makers of
> TotalView, The debugger
> for complex code. Debugging C/C++ programs can leave you
> feeling lost and
> disoriented. TotalView can help you find your way. Available
> on major UNIX
> and Linux platforms. Try it free. http://www.etnus.com
> _______________________________________________
> Ext2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ext2-devel
>


2003-03-05 06:44:55

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [Ext2-devel] Re: ext3 htree brelse problems look to be fixed!

On Tue, Mar 04, 2003 at 06:36:54PM -0800, Christopher Li wrote:
> I post a patch for comment on ext2-devel for the
> NFS cookie bug. Did not get any feedback yet.
> As Ted suggested, it set the cookie to -1 on EOF,
> even though it is not seek able to there.

The patch was almost good enough. The problem with your simple
version was that on the subsequent call to ext3_dx_readdir, the -1 got
translated to a hash value of fffffffe, and if you were unlucky enough
to have a file whose hash was 0xfffffffe, you'd still end up looping
forever.

See the patch which I just sent to ext2-devel and LKML, which I think
solves both this problem and the conversion-to-htree-while-doing-NFS-readdir
problem. What I did was to treated f_pos==-1 as an explicit EOF cookie,
instead of letting it get translated into large hash value. I also explicitly
returned a next_hash value of ~0 when there was no more leaf pages, which
then got immediately translated into a f_pos value of -1. This saves an
extra call to ext3_htree_fill_tree(), a minor optimization.

- Ted