9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Karl Magdsick <kmagnum@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] Acme mailreader - now: User mode filesystems in linux
Date: Fri, 17 Dec 2004 09:42:15 -0500	[thread overview]
Message-ID: <cd8ecdef04121706421f5d681c@mail.gmail.com> (raw)
In-Reply-To: <20041217152456.3f377069.martin_ml@parvat.com>

> On login, each user starts a user-filesystem-daemon, which uses setuid
> to create a /dev/cfsN, if necessary, opens it to start serving, and
> mounts it on a conventional place: $HOME/mnt, say.

Why are the setuid meta-daemons needed?  You'll want security/sanity
checks within the kernel code anyway, so the main reason for the
setuid meta-daemons is creating(??/destroying??) device files.  It
seems that you could get around this by using one device file for
everyone, which brings us to...

Why N different devices?  The kernel can distinguish between open
filehandles for /dev/cfs and use an array, tree, or map of structs to
keep track of which file handle goes with which mount point.  (Yay,
flyweight design pattern!)  This prevents nastiness with trying to
find an unused device, creating devices on demand, and "garbage
collecting" unused device files.  (You wouldn't want a trillion unused
devices sitting around.)  The kernel can free associated structs when
filehandles close.  Having the meta-daemons garbage collecting unused
device files seems like trouble.
 
> When the user runs a program that wants to serve a filesystem, it attaches to
> the daemon, which creates $HOME/mnt/servicename, and forwards all
> requests for this directory hierarchy to the program. 

As mentioned in another post, you can prevent device files and setuid
executibles in non-root owned filesystems and allow any user process
to mount a fs on any mount point they own.

The kernel needs its own cleanup code (what if one of the per-user
filesystem meta-daemons crashes?) and security/sanity checks (only
allowing root-owned processes to open filehandles to the device).

Granted, using a map of N structs and 1 device instead of N devices
each with 1 struct does increase kernel complexity, but only by a
small amount.  The kernel needs its own security/sanity checks and
cleanup code even in the case of per-user setuid filesystem
meta-daemons.  Setuid per-user filesystem meta-daemons seem like they
would greatly increase user-space complexity (and duplicate
functionality that MUST also be in the kernel) and only minimally
reduce kernel complexity.

Don't get me wrong, I'm a big fan of micro/nanokernels.  I dual booted
BeOS 5 and L4-Linux on my desktop, back when the latest port to L4
user-space was Linux 2.2.(??20??).  I got a warm fuzzy feeling every
time my BeOS flakey 3Com NIC driver crashed and BeOS asked me if I
wanted to restart the network driver.  Buggy drivers weren't so fun,
but a system that easily recovers from driver crashes is just cool! 
(I had a UDFS CD that would cause fs driver crashes in both Linux
(kernel panic) and Win2k (BSOD).  I really wished for user-space fs
drivers on "normal" systems.)  After a few days of 2 L4-Linux system
lock-ups per day, I went back to using Linux as a regular kernel. 
(The diagnostic counters kept spinning, so it seemed that the Linux
server had locked up, not L4, but all of my processes depended on the
Linux server anyway.)

In any case, I'd love to see user-space filesystem (and device)
drivers on mainstream OSes.

I don't have much knowledge of/experience with Plan9, but I've read
that the system is designed so that it's very easy to port drivers
between user-space and kernel-space.  Is this correct?  In a
"standard" setup, how many of the drivers are (mostly) in user-space?


-Karl


  parent reply	other threads:[~2004-12-17 14:42 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-15 15:34 [9fans] Acme mailreader jim
2004-12-15 15:40 ` gdiaz
2004-12-15 15:47   ` jim
2004-12-15 15:50     ` Joseph Stewart
2004-12-15 15:57       ` jim
2004-12-15 16:10       ` Russ Cox
2004-12-15 15:58     ` Charles Forsyth
2004-12-15 16:04       ` jim
2004-12-15 16:24         ` C H Forsyth
2004-12-15 16:31           ` jim
2004-12-15 17:07             ` Russ Cox
2004-12-15 17:30               ` jim
2004-12-15 18:33                 ` Russ Cox
2004-12-15 18:49                   ` jim
2004-12-15 18:36               ` Axel Belinfante
2004-12-15 18:47                 ` jim
2004-12-15 18:51                 ` rog
2004-12-15 18:48             ` Skip Tavakkolian
2004-12-15 16:05       ` rog
2004-12-15 16:07 ` rog
2004-12-15 16:09   ` jim
2004-12-16  0:24     ` geoff
2004-12-16  4:12       ` Ronald G. Minnich
2004-12-16  4:51         ` geoff
2004-12-16  9:25           ` jim
2004-12-16  5:13         ` Skip Tavakkolian
2004-12-16  5:17           ` geoff
2004-12-16  5:20             ` boyd, rounin
2004-12-16  5:34               ` boyd, rounin
2004-12-16  5:29             ` Skip Tavakkolian
2004-12-16 15:54             ` Ronald G. Minnich
2004-12-16 17:52               ` Skip Tavakkolian
2004-12-16 18:13               ` Dave Eckhardt
2004-12-16  5:23           ` Andy Newman
2004-12-16 15:52           ` Ronald G. Minnich
2004-12-16  8:17       ` Martin C.Atkins
2004-12-16  9:35         ` jim
2004-12-16 15:19         ` rog
2004-12-16 15:26           ` jim
2004-12-16  9:30       ` jim
2004-12-16 15:08       ` David Leimbach
2004-12-16 23:22         ` geoff
2004-12-16 23:25           ` boyd, rounin
2004-12-16 23:38           ` Ronald G. Minnich
2004-12-17  1:31             ` Skip Tavakkolian
2004-12-17 15:50               ` Ronald G. Minnich
2004-12-17  4:55           ` [9fans] Acme mailreader - now: User mode filesystems in linux Martin C.Atkins
2004-12-17  9:54             ` Martin C.Atkins
2004-12-17 10:22               ` geoff
2004-12-17 10:45                 ` Martin C.Atkins
2004-12-17 11:42                 ` Andy Newman
2004-12-17 15:57                   ` Ronald G. Minnich
2004-12-17 12:30                 ` Latchesar Ionkov
2004-12-17 15:55                 ` Ronald G. Minnich
2004-12-17 13:41               ` Derek Fawcus
2004-12-17 14:42               ` Karl Magdsick [this message]
2004-12-17 14:56                 ` Russ Cox
2004-12-18  0:13               ` Tim Newsham
2004-12-18  0:13                 ` boyd, rounin
2004-12-18  3:49                   ` Ronald G. Minnich
2004-12-23 16:04                     ` boyd, rounin
2004-12-17 15:44             ` Ronald G. Minnich
2004-12-18 12:35               ` Martin C.Atkins
2004-12-17 18:52           ` [9fans] Acme mailreader David Leimbach
2004-12-17 23:20             ` Jack Johnson
2004-12-18  1:00               ` David Leimbach
2004-12-15 16:09 ` Russ Cox
2004-12-15 16:16   ` jim
2004-12-15 16:22   ` boyd, rounin
2004-12-17 15:31 [9fans] Acme mailreader - now: User mode filesystems in linux bmaroshe

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=cd8ecdef04121706421f5d681c@mail.gmail.com \
    --to=kmagnum@gmail.com \
    --cc=9fans@cse.psu.edu \
    /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).