Re: [PATCH] root-hopping for pre-2.3.41-3

From: Werner Almesberger (almesber@lrc.di.epfl.ch)
Date: Wed Jan 26 2000 - 09:59:37 EST


Horst von Brand wrote:
> Extra acceses when mounting would be preferable to complicating everything
> else, IMMHO.

I think that's what Peter meant. Actually I think we can try to make an
educated guess to predict what he'll do :-)

A bit of dentry theory: if we have a dentry, the most important
pointers are:
 - d_parent: points to the parent or, if at the top of a file system,
   to itself
 - d_covers: points to the directory on which we're mounted, or to
   itself
 - d_mounts: points to the directory that's mounted on it, or to
   itself
 - d_child, etc.: pointers to child dentries for forward lookups
   (it's actually a bit more complicated, because names are stored
   elsewhere, in fs/dcache.c:dentry_hashtable)

                 ^ Let's use n, U, and ( to
                 | indicate a pointer that
              d_mounts points back to the
                 | dentry.
<--d_parent---[dentry]---d_child--->
                 | etc.
             d_covers
                 |
                 v

At a mount point, things look like this:

      n
   ([bar]-... <tree of bar> "foo" and "bar" are not real names.
     ^ | The real names are in a global hash
     | v table. Dentry "bar" is mounted on top
...-[foo]-... <hidden tree of "foo".
      U of foo>

Forward travel is by
 - lookup child dentry
 - go to its d_mounts (fs/namei.c:follow_mount)
Backward travel (..) is by
 - dentry = dentry->d_covers->d_parent (fs/namei.c:reserved_lookup)

If we keep these semantics, overmounting would have to look like
this (assuming there are no funny semantics a la IFS/TFS):

   ([zulu]-... <tree of zulu>
    ^ |([bah]-... <hidden tree of bah>
    | | |([bar]-... <hidden tree of bar>
    | | | |
    | v v v
...-[xyzzy]-... <hidden tree of xyzzy>
      U

(The sub-trees hanging off zulu, bah, and bar are independent.)

So all that's left is to have a list of "hidden" mount points
underneath the current one (e.g. zulu -> bah -> bar), the
occasional fixes for all places that assume
X->d_mounts->d_covers == X
(they should be pretty much concentrated in fs/super.c), plus
the removal of checks that disallow mounting on top of a mount
point (ditto).

Peter, how good is my guess ?

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH       werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

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



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:16 EST