"Troy Rollo" <t...@parrycarroll.com.au> writes:

> You can hard link a directory (historically done as root using /etc/link or
> /sbin/link rather than /usr/bin/ln or /bin/ln).

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.

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;

So, you could, but only if you go back far enough that unlink('/') worked,
along with those other nasty ways to break the file system and all. :)

> Doing so traditionally requires (1) root; and (2) a direct call to the
> "link" system call (which is what the old /etc/link and /sbin/link did).

...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.

> However if this is indeed what has been done, then I can speculate as to
> what might have happened. I seem to recall that the Linux kernel caches the
> file system hierarchy

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.

> in which case there is might be a chance that the kernel cached hierarchy
> does not reflect what is on disk.

Well, if the file system was fundamentally broken it would certainly break
caching, but usually in vastly more nasty ways than this.

> Hard linking directories is a sufficiently unusual thing to do that it is
> possible such a cache was never tested against it.

Actually, it is impossible in anything resembling a recent Linux kernel as
noted, so this categorically *cannot* be the cause of the issue.

        Daniel
-- 
✣ Daniel Pittman            ✉ dan...@rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons
--
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