Re: Fw: [POSSIBLE-BUG] telldir() broken on ext3 dir_index'ddirectories just after the first entry.

From: Stephen C. Tweedie
Date: Thu Nov 18 2004 - 10:42:37 EST


Hi,

On Thu, 2004-11-18 at 04:53, Theodore Ts'o wrote:

> > If we're going to do this, I think we need to stuff . and .. into the
> > rbtree with the right hashes, but without ignoring other existing
> > dirents with colliding hashes.
>
> We can't just do that, because there are programs that's assume '.'
> and '..' are the first and second entries in the directory. Yes, they
> are broken and non-portable, but so are programs that depend on
> d_off....

Sorry, by "right hashes" I meant adding them with hashes 0 and 2 but in
the correct place in the stream; so if we do have a hash collision on
major-hash==0, we'll get ".." slightly out of order, but will still
correctly provide all the entries. And your second patch seems to do
exactly that. Thanks!

> This patch should do this.

Looks good to me --- have you tested it much?

The only remaining thing I can think of is what happens if the while()
loop at the end of ext3_htree_fill_tree() exits successfully after
filling in hash-major==0. Then we'll restart at 2 next time, and will
return ".." twice.

I'm not sure that's actually possible, though. Moving the filling-in of
".." into the while loop would deal with this rare possibility.

--Stephen

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