Re: Creating hardlinks for directories.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vikram Goyal wrote:
> Rummaging through the man pages and pondering over the problem I came
> across ln man page. An excerpt:
> 
>        -d, -F, --directory
>               allow the superuser to attempt to hard link directories
>                 (note: will probably fail due to system restrictions,
>                                                  even for the superuser)
> 
> So I tried it as super user but failed miserably. Then I thought if the
> option is there then there must exist a possible way of usage.

Please note that the ln command and associated manpage come from the GNU
project. As such, they are certainly not Linux-specific. I understand
that many of the GNU utilities pre-date the Linux kernel: they were
certainly designed to install on a large number of weird and
less-than-wonderful archaic systems. (And this was common, especially
on systems which saw a lot of interactive shell use).

So the "possible way of usage" could include "using GNU ln on a
different system with a different C library and a different kernel".

To the best of my knowledge, this *is* the only way. The e-mail at
http://lwn.net/Articles/100184/ dates from August 2004, but Linus
Torvalds explicitly says:
    The general VFS layer has a lot of rules, and avoids these problems by
    simply never having aliases between two directories. If the same directory
    shows up multiple times (which can happen with bind mounts), they have the
    exact same dentry for the directory, it's just found through two different
    vfsmount instances. That's why vfsmounts exist - they allow the same name
    cache entry to show up in different places at the same time.

In other words, if a directory is hard linked, it's a kernel bug.

James.
-- 
E-mail address: james | You know you've been computing too long when you see a
@westexe.demon.co.uk  | BBC News headline "MS damage repair mechanism found",
                      | and wonder why that's news. Then you wonder why it's
                      | listed under Health...


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux