Re: bug: mount on an open directory succeeds

From: Alexander Viro (viro@math.psu.edu)
Date: Mon Mar 06 2000 - 05:21:10 EST


On Mon, 6 Mar 2000, V Ganesh wrote:

> > They have. ls(1) is buggy, that's it. If you want the listing of "." -
> > fine, open ".", but then you must care to call stat() on ./name. Yes,
> > there is no way to open the mountpoint. So?
>
> so it breaks the assumption that . == pwd.

Yes, it does.

> $ ls
> foo bar
> $ cat foo
> foo: no such file or directory
> $ cat ./foo
> FOO
> $
>
> cat foo ought to have worked. anything else is a gross violation of the least
> surprise principle, if not any actual standard.

Excuse me? Why? We have an object - pwd. Lookup goes from that object.
_That_ should not be changed by any mount. Notice that if you had it
opened before mount() readdir() on it would return its contents.

Look: step of lookup ends with the step upwards. It's 3-d structure, not
2-d one. You are getting exactly what you ask for - "." is "do the step
with zero horizontal part". E.g. "go upwards". Which is no-op for
everything except the mountpoints. Your problem being?

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



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:19 EST