Re: rmdir of a busy directory

Alexander Viro (viro@math.psu.edu)
Fri, 12 Feb 1999 00:12:10 -0500 (EST)


On Thu, 11 Feb 1999, Alan Curry wrote:

> For as long as I can remember, if you removed a directory which is the
> current working directory of a process (for example, a shell), and then tried
> to do anything with that process that accesses the current working directory
> (for example, type "ls"), you'd get a ENOENT.
>
> Under 2.2, though, the opendir(".") succeeds and creates the appearance of an
> empty directory. Even stranger, attempts to creat() or mkdir() in the
> nonexistent directory yield EPERM.
EPERM is absolutely reasonable - it's a pseudo-directory, it
doesn't exist on a disk anymore and nothing can be created there (nowhere
to create). Think of it as an analog of revoke() results. Returning ENOENT
on readdir() doesn't make much sense. ENOENT on opendir()? Maybe. That's
not hard to implement. Actually we need a generic mechanism to revoke
access to directory - that would take care of rmdir() on busy directory on
all filesystems. I'll look at it.

> Is this now the expected behavior, or was there an accident in last-minute
> rmdir() changes?

Mix of both. It's correct behaviour, but it was an ad-hocery.

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