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

Alexander Viro (viro@math.psu.edu)
Wed, 10 Jan 2001 12:28:38 -0500 (EST)


On Wed, 10 Jan 2001, Andrea Arcangeli wrote:

> > Do we have enough protection to ensure this for other filesystems?
>
> Note that this has nothing to do with `rmdir .`. You will run into the
> mentioned issue just now with '''rmdir "`pwd`"'''. I've not checked
> the other fses but I would put such support into the VFS rather than in ext2
> (vfs can do that for you, if you do that the lowlevel fs will never get a
> readdir for a delete dentry).

That's precisely what I've already done. grep for IS_DEADDIR() and notice
that it's only checked under ->i_zombie. Both rmdir() and rename() hold
it on victim, readdir() holds it on directory it wants to read and everything
that creates or removes objects holds it on parent. Successful rmdir()
and rename()-over-directory set S_DEAD in the ->i_flags before dropping
->i_zombie.

The only thing that can happen with the dead directory is ->lookup().

IOW, in 2.4 most of filesystems had dropped the -EBUSY on rmdir() they
used to have. And ext2 got rid of the special handling of dead directories -
these checks are done in VFS now. The only fs with special treatment of
rmdir()/rename() wrt busy victims is NFS, IIRC.

Filesystems still can refuse to remove busy directories (same test as in
2.2) but there's almost no reasons for that.

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