hard links to directories
Posted Sep 14, 2007 6:32 UTC (Fri) by
nix (subscriber, #2304)
In reply to:
hard links to directories by Duncan
Parent article:
The many faces of fsck
The . and .. directory entries in the roots of filesystems don't actually
exist, but are faked by the VFS. (There's no reason why the filesystem
couldn't generate all . and .. entries that way, and IIRC some do.)
Once upon a time . and .. really were real hardlinks,
and /usr/lib/{mk,rm}dir (IIRC) were setuid root programs that
created/removed the directory and manipulated these links. This turned out
to have unfixable races, so was replaced with an in-kernel call, but some
Unixes (notably Solaris) maintained the semantics that unlink() of a
directory as root was permitted (which caused some aggro on the git list
recently).
Multiple hardlinks to a directory are theoretically implementable, and
under Linux the biggest problem (`where does .. take us?') is solvable
using the dcache; but allowing it will confuse users to some extent.
(Linus said that he had no major objections to allowing directory
hardlinking --- the we don't corrupt filesystems kind --- about seven
years or so ago, but nothing happened after that that I know of.)
(
Log in to post comments)