Re: rmdir of one's pwd (was Re: rmdir of a busy directory)

Martin Tessun (martin.tessun@class.de)
Mon, 15 Feb 1999 12:06:45 +0100


Andreas Schwab wrote:
> I have now found the difference: the home directory, where i tested it, is
> mounted via lofs. I can confirm that rmdir fails as documented on tmpfs
> (/tmp) and ufs (/var/tmp).

You are right, if you use lofs directly e.g.:

mount -F lofs /local /mnt

But that's like a symbolic link. That means you can't determine the cwd
correctly (If you do a cd .. at /mnt/x you are in /local). But
nevertheless was lofs designed to be mounted like

mount godzilla:/local /mnt

if your machine names godzilla. And in this way the rmdir works as
expected. So I think the above error is a bug in lofs.

> But it looks still strange to treat the pwd of the current process in such
> a special way. That does not make any sense.

Well I think so: Imagine the current process deletes its
working-directory. Then it tries to access a file e.g. ../cfg/test. This
results in an error, because the process can't determine its current
working directory, so the relative path fails and the process dies
probably.

In my eyes this is the cause for not allowing the cwd be removed by the
running process. (Of curse, if another process deletes the directory the
process will die nevertheless).

Bye
Martin

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