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

From: Henrik Grubbström
Date: Mon May 09 2005 - 10:01:13 EST


On Mon, 9 May 2005, Stephen C. Tweedie wrote:

> 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.

All true.

Since the htree stuff is implemented in the same file and the get_parent
operation is rather basic I didn't see much point. The advantages of my
patch are that it looks at a single directory block and that it doesn't
affect the i_dir_start_lookup state kept for non dx-directories.

> Cheers,
> Stephen

--
Henrik Grubbström grubba@xxxxxxxxx
Roxen Internet Software AB

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