Re: patch for 2.1.48 autofs race

Linus Torvalds (torvalds@transmeta.com)
Fri, 8 Aug 1997 10:28:58 -0700 (PDT)


On Fri, 8 Aug 1997, Bill Hawes wrote:
> Linus Torvalds wrote:
> > However, I think it actually would be better to do this at the VFS layer,
> > and not have the low-level filesystems every know about "dentry counts".
> > It's bad form by the VFS layer anyway to let dentries with a zero count be
> > around (except when holding the name lookup spinlock, which I still
> > haven't gotten around to actually create yet although it should be trivial
> > to do as the code has been designed with the spinlock in mind).
>
> I agree completely. I would like to see (1) d_alloc() called without
> the parent pointer, and initial d_count=1, (2) in lookup, if the d_alloc
> succeeds install the parent pointer via dget(parent), (3) then if
> i_op->lookup fails, do a dput(result) instead of d_free. (And remove the
> dget(parent) from d_add, since the parent count has been bumped.)
>
> This would shore up what is currently a very fragile interface.

More agreement. However, the current low-level "lookup()" interface
doesn't get the parent at all (it only gets the directory inode, which is
not enough - you can't tell what dentry is the parent if you have
directory aliases, something that will happen when we implement loopback
mounts).

So the above is not just a few minor shuffles here and there, it also
requires lookup to get the parent dentry instead of the parent inode.

On the whole I think it should be done, I just don't have it very high on
my list of things to do yet.

Linus