`rmdir .` doesn't work in 2.4
--------- Received message begins Here ---------
Quoted 10 lines
Hello Al,
why
rmdir .is been deprecated in 2.4.x? I wrote software that depends onrmdir .to work (it's local software only for myself so I don't care that it may not work on unix) and I'm getting flooded by failing cronjobs since I put 2.4.0 on such machine.rmdir .makes perfect sense, the cwd dentry remains pinned by me until Icd .., when it gets finally deleted from disk. I'd like if we could resurrect such fine feature (adapting userspace is just a few liner but that isn't the point). Comments?
Not exactly valid, since a file could be created in that "pinned" directory after the rmdir...
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: [email protected]
Any opinions expressed are solely my own.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · Jesse Pollard
Not exactly valid, since a file could be created in that "pinned" directory after the rmdir...
In 2.2.x no file can be created in the pinned directory after the rmdir.
Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · Jesse Pollard
Not exactly valid, since a file could be created in that "pinned" directory after the rmdir...
No, it couldn't (if you can show a testcase when it would - please do, you've found a bug). Moreover, busy directories can be removed in 2.4 quite fine - it's about pathname, not about the thing being your (or somebody else) pwd.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Hi,
Quoted 5 lines · Andrea Arcangeli
Quoted 2 lines · Jesse Pollard
Not exactly valid, since a file could be created in that "pinned" directory after the rmdir...
In 2.2.x no file can be created in the pinned directory after the rmdir.
In 2.2, at least some of that protection was in ext2 itself. POSIX mandates that a deleted directory has no dirents, so readdir() must not return even "." or "..". ext2 achieved this by truncating the dir to size==0, and by refusing to add dirents to the resulting completely empty directory.
Do we have enough protection to ensure this for other filesystems?
--Stephen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Quoted 9 lines · Stephen C. Tweedie
Hi,
Quoted 5 lines · Andrea Arcangeli
Quoted 2 lines · Jesse Pollard
Not exactly valid, since a file could be created in that "pinned" directory after the rmdir...
In 2.2.x no file can be created in the pinned directory after the rmdir.
Quoted 7 lines
In 2.2, at least some of that protection was in ext2 itself. POSIX mandates that a deleted directory has no dirents, so
readdir()must not return even "." or "..". ext2 achieved this by truncating the dir to size==0, and by refusing to add dirents to the resulting completely empty directory.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).
Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Quoted 7 lines · Andrea Arcangeli
Quoted 1 line
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 [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Quoted 1 line · Alexander Viro
That's precisely what I've already done. grep for
IS_DEADDIR()and notice
Fine ;)
Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/