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

Theodore Ts'o (tytso@mit.edu)
Wed, 5 Mar 2003 01:54:20 -0500


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/