[CLUE-Tech] Finding all hard links to a file

Timothy Klein teece at silverklein.net
Sun May 16 00:42:47 MDT 2004


On Saturday 15 May 2004 11:35 pm, Jim Ockers wrote:
> Hey, this reminded me of something.  What is it about directories that
> makes it impossible to make more than one hardlink to a directory inode?
> A few years ago I tried to figure out why you couldn't do this, but I
> failed and haven't revisited the question.  I think I read that on one
> flavor of unix you could do that, but Linux had it disabled in the
> kernel.
>
> So, what would need to happen for there to be two directory inodes both
> pointing to the same list of files?

W. R. Stevens in _Advanced Programming in the Unix Environment_ says that only 
the superuser can create a hard link to a directory.  He gives the reason as 
potential file system loops.  Presumably Linux changed that from only root to 
'don't do it.'  He mentions that symbolic-link loops are easy to remove, but 
that hard-link loops are very hard to remove, indeed he says that when he 
created one to test for the book, it corrupted his file system.

I don't really have the time to grok it now, but it is in sections 4.14, 4.15, 
and 4.16 in that book, if you have access to it.

Tim
-- 
== Timothy Klein || teece at silverklein.net   
== Vanity Page: http://tinyurl.com/vkhp    
== ---------------------------------------- 
== Hello_World.c: 17 Errors, 31 Warnings...




More information about the clue-tech mailing list