Re: fsync on large files

G. Allen Morris III (gam3@harpo.ixlabs.com)
Sun, 21 Feb 1999 22:50:58 -0800


One thing you might try is only allow directories to be linked if
the new links are at the same distance from the root. While this
would limit the usefulness of the hard linked directories it would
help with `chroot'. An example would be if you wanted to chroot
users into their home directories. You create:

/home/skel/usr/bin
/lib
/etc

and then you could run

ln /home/skel/usr/ into /home/gam3/usr/
ln /home/skel/usr/ into /home/ann/usr/

This might make it so that NFS could only export from the root if you
have hard linked directories.

>>>Edgar Toernig said:
> Hi,
>
> Linus Torvalds wrote:
> > Imagine, for example, a directory tree with a shared component. Wouldn't
> > it be nice to just link it into the tree at multiple points? Imagine a
> > chroot() environment, for a moment - symlinks don't work to the outside,
> > but hardlinking does.
>
> Sure, it would be nice. But it's really hard and not easy to implement.
>
> The traditional unix filesystem forms a nice n-ary tree. Symbolic links
> turn your tree into a graph. But, it is required, that the tree be
> preserved by the hard links. The soft links are just there to go
> somewhere in different ways. They do not _build_ the tree.
>
> mkdir creates a new leaf node, unlink removes one, and rename moves a
> subtree to a different location. Checks like: you mustn't move a dir
> to one if its descendants (meaning, you mustn't disconnect a subtree
> from the main tree), are easy because there's only _one_ point where
> this node is connected to the tree.
>
> If you allow directory hardlinks (or loopback mounts) you get a completely
> different structure: a directed graph with all it's problems (like rings).
> Reconfiguring a graph with some constraints like: you mustn't isolate a
> subgraph from the one containing the root node, is pretty hard. You
> have to scan the _whole_ graph to check this. And, try to remove a
> part of the graph. There may be _no_ leaf nodes, only rings. This means,
> you have to allow to unlink non-empty dirs. And this results in a garbage
> collector...
>
> Yeah, would be nice, but hard *g*
>
> Ciao, ET.
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

---------------------------------
G. Allen Morris III

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/