Re: [PATCH] Support for dx directories in ext3_get_parent (NFSD)

From: Stephen C. Tweedie
Date: Mon May 09 2005 - 09:08:03 EST


Hi,

On Mon, 2005-05-09 at 10:46, Henrik Grubbström wrote:

> > ext3_get_parent() is IMHO the wrong place to fix this bug as it introduces
> > a lot of internals from htree into that function. Instead, I think this
> > should be fixed in ext3_find_entry() as in the below patch. This has the
> > added advantage that it works for any callers of ext3_find_entry() and not
> > just ext3_lookup_parent().
>
> The reason I didn't put it there is that handling of ".." is usually
> performed by fs/namei.c:link_path_walk() and putting it in
> ext3_find_entry() or one of the functions it calls would slow down the
> common case.

True, but the extra cost is to evaluate

if (namelen > 2 || name[0] != '.'||(name[1] != '.' && name[1] != '\0')

as false. That's not going to take long most of the time. And this
solution has two other big advantages: it fixes things for all lookups,
not just NFS, and hence is safer against this bug cropping up again in
the future in unexpected places; and it includes less dependency on
htree internals, as Andreas said.

I'll have a closer review of the patch, but for now I think I like
Andreas's version better.

Cheers,
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/