On Thursday 01 July 2010 19:00:34 Daniel Pittman wrote:

> On which file system, without causing it serious errors?  I can't say
> categorically that nothing allows it, but it is considered to be a serious
> violation of the semantics of the system by ... well, most things.

You certainly used to be able to do it on the historical UNIX filesystems.

> Certainly all the common file system drivers in Linux, as well as by the
> core VFS; see http://lxr.linux.no/linux+v2.6.34/fs/namei.c#L2423 for
> vfs_link:
>
>     2445        if (S_ISDIR(inode->i_mode))
>     2446                return -EPERM;

I wasn't aware Linux had departed from history in that way. That would 
certainly prevent such links from being created under Linux. It does not 
exclude the possibility of some non-linux filesystem being in use that does 
allow it, with the hard link having been created on some other platform (of 
course we assume here that things were done under Linux, so that would be out 
of scope for the question unless the poster mentioned it).

> ...while you used to be able to break things as root, on some platforms, it
> wasn't ever considered a healthy thing to do — at least, to the best of my
> knowledge on the topic.

It was always considered a bad idea, although in some limited circumstances 
useful. Apparently some backup tools on OSX (or whatever it's called this 
week) do it. The old UNIX philosophy was that the kernel would allow root to 
hose the entire system if that is what root really wanted to do, rather than 
adopt a more paternalistic approach.

> Nope.  That isn't even close to accurate; the way data is cached varies
> wildly between different systems, but it isn't especially hierarchical;
> file data is usually in the page cache indexed by inode.

File data, yes. But directory information under Linux also uses the "dcache" 
(see include/linux/dcache.h in the kernel source), which is the caching I was 
refering to. As I said I was speculating. I may be wrong about whether the 
dcache could be caused to be out of synch by hard links to directories.

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to