Re: `rmdir .` doesn't work in 2.4

Albert D. Cahalan (acahalan@cs.uml.edu)
Tue, 9 Jan 2001 04:31:24 -0500 (EST)


Alexander Viro writes:

> [...] If you really need to destroy the directory
> that happens to be your pwd - sorry, no reliable way to do that without
> interesting locking. On _any_ UNIX out there. 2.2 included. It will
> happily give you -ENOENT and refuse to perform the action above in
> case if some other process renames your pwd. Yes, for rmdir(".");

Well, this bites.

Locking guess: use a global read-write lock, with the "write" case
being deletion of "." and the "read" case being everything else.
You could have one lock per CPU, with the writer needing to grab all
of them in order. So removal of "." pays the cost.

If the standards gripe, well, rmdot() is a nice name.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/