9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Alexander Viro viro@math.psu.edu
Subject: [9fans] Plan 9 future (Was: Re: Are the Infernospaces gone?)
Date: Tue,  9 May 2000 10:46:12 -0400	[thread overview]
Message-ID: <20000509144612.ynhlTtc-KZi2dwM2Il8NxMwj98NajKZkCksnPBN9fiQ@z> (raw)



On Tue, 9 May 2000 forsyth@vitanuova.com wrote:

> >>1995 vintage Plan 9 one - e.g. our design handles ".." for any mount
> >>graphs in the right way, ditto for pwd, etc. I'ld love to compare the
>
> what is `the right way'?

See the comment in pwd(1) for the wrong one ;-) In our variant effect
of bind() can't be distinguished from the effect of fresh mount() - you
are getting a tree spliced onto the point in your namespace and that's it.
And no, we don't create a new dentry tree. The main idea being that we
added a new class of objects - mount nodes and use them to represent mount
linkage. Namespace is represented as a tree of mount nodes and each node
refers to a couple of dentries - mountpoint and root, that is. These
dentries belong to the forset - each tree comes from a filesystem and this
forest is the same for everyone. You have to deal with pairs (mount node,
dentry) to identify points in the namespace. That's the basic idea - doing
that required some changes to our data structures, etc., but pain was
surprisingly small. Implementing the namei(), bind(), etc. with these data
structures is more or less an obvious exercise. Union-mounts are done with
a special kind of mount node that anchors the cyclic list of components'
nodes. To avoid special-casing for covered directory we add into this list
a node with root equal to dentry of covered directory (in effect, bind the
covered directory into the union).

One difference being that our equivalent of bind() binds only the chunk
that contains the object we are binding. If /foo and /foo/bar/baz
are mountpoints and you bind /foo/bar onto /barf you will _not_ get
/barf/baz as a mountpoint. For one thing, if you want "recursive"
behaviour of bind() (a-la Plan 9 one) you can emulate it in userland,
unless there are _real_ loops. And these are rather bad idea - say ls -lR
and watch it running forever... In our case you can bind / onto /mnt and
that will not create any loops - you'll have the same effect as you would
get from mounting the root filesystem onto /mnt.

So there... I consider this tradeoff (non-recursive behaviour of bind())
worth the things it gives. YMMV. With that data structure per-process
namespaces become absolutely trivial - nothing cares whether the mount
nodes form a connected graph or not. So it's a matter of garbage-collector
(plain refcounting) and cloning the tree + switching your pwd, etc. in our
equivalent of rfork() (clone(2)). BFD...

If you need more details - feel free to ask, I'll be only happy to discuss
them. I'm really curious about the implementation in current Plan 9
kernel - would be interesting to compare...

There were rather, erm, funny moments - we had to support fchdir(2), for
one. And link(2). And full-blown rename(2) <stream of expletives>. Oh,
well - it took long, but it had been done...





             reply	other threads:[~2000-05-09 14:46 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-09 14:46 Alexander [this message]
     [not found] <200005052042.QAA06869@er7.rutgers.edu>
2000-06-12 10:09 ` Tom E Arnold
  -- strict thread matches above, loose matches on Subject: below --
2000-05-10 12:22 rob
2000-05-10 10:17 Lucio
2000-05-10  9:49 Lucio
2000-05-10  8:51 Noel
2000-05-10  8:51 Douglas
2000-05-09 17:53 Alexander
2000-05-09 17:14 Alexander
2000-05-09 17:07 forsyth
2000-05-09 17:05 rob
2000-05-09 16:55 Russ
2000-05-09 16:31 Alexander
2000-05-09 16:18 Alexander
2000-05-09 16:15 rob
2000-05-09 16:10 dhog
2000-05-09 11:48 forsyth
2000-05-09  8:18 Douglas
2000-05-09  8:18 Ishwar
2000-05-08 20:35 Alexander
2000-05-08 20:11 Roman
2000-05-08 16:12 Russ
2000-05-08 13:45 Lucio
2000-05-08 13:05 Bengt
2000-05-08 12:48 Lucio
2000-05-08 12:09 Leo
2000-05-08  6:56 Bengt
2000-05-08  6:28 okamoto
2000-05-08  4:34 Russ
2000-05-08  4:33 rob
2000-05-08  3:55 okamoto
2000-05-06 12:47 Steve
2000-05-06  7:28 Lucio
2000-05-06  7:04 Lucio
2000-05-05 22:00 G.David
2000-05-05 20:53 Scott
2000-05-05 20:42 Anthony
2000-05-05 17:08 Lucio
2000-05-05 16:38 Lucio
2000-05-05 15:32 forsyth
2000-05-05 14:45 Lucio
2000-05-05 14:44 jmk
2000-05-05 14:42 Lucio
2000-05-05 14:20 Lucio
2000-05-05 14:14 Lucio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000509144612.ynhlTtc-KZi2dwM2Il8NxMwj98NajKZkCksnPBN9fiQ@z \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).