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/