Cyclic directories (i-nodes) on the UNIX pc filesystem.
John B. Milton
jbm at uncle.UUCP
Sat Nov 11 17:17:51 AEST 1989
In article <1285 at mitisft.Convergent.COM> dold at mitisft.Convergent.COM (Clarence Dold) writes:
>in article <1021 at icus.islp.ny.us>, lenny at icus.islp.ny.us (Lenny Tropiano) says:
[found cyclic dir in lost+found, etc]
[dirs can be unlinked by root]
All this brings up a whole set of nasty things in UNIX. The fact that
directories can be linked is why . and .. work. The fact that mkdir and rmdir
use simple mknod/link/link and unlink/unlink/unlink (at least on our flavor of
UNIX) means that crashes during incomplete updates of either of these can leave
weird things. Since root can do link and unlink on directories, then root CAN
"corrupt" the disk:
{
system("mkdir a"); /* we now have a, a/. and a/.. */
unlink("a"); /* now a/. is floating and a/.. has a bad link count */
}
This kind of corruption is not harmful, but does give fsck some work to do.
As far as using linked directories, there are some interesting applications.
The down side is that the UNIX utilities were not designed to deal with the
problems, like cpio making two copies and du showing too much. Another
problem with linked directories comes when they are dismantled. If rmdir
is used, then the . and .. entries are lost.
The fact that fsck doesn't do anything about strange directory links is
probably weak support for the feature, since it can't be used if fsck keeps
undoing it. This is like linking on DOS, where it can be done, but chkdsk
does not like it.
John
--
John Bly Milton IV, jbm at uncle.UUCP, n8emr!uncle!jbm at osu-cis.cis.ohio-state.edu
(614) h:252-8544, w:785-1110; N8KSN, AMPR: 44.70.0.52; Don't FLAME, inform!
More information about the Unix-pc.general
mailing list