tech-kern archive

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

virtual kernels, syscall routing, etc.



Good news everyone!

I've made the kernel nfs service (nfsd) run in userspace.

... well don't everyone faint from overexcitement all at once.
(instructions for the very curious people available at the end of
this email)

Anyway, what sets this apart from the previous kernel components I've made
environment independent (i.e. can run both in the kernel and userspace)
is that nfsd is really a collaboration of three different services each
with their own userspace daemon: rpcbind, mountd and nfsd.

If mountd and nfsd have their own independent virtual kernels in their
processes, things simply do not work: the export list that mountd parses
from /etc/exports and loads into the kernel must be in the same virtual
kernel as where nfsd tries to search it from when it handles requests.
Currently this is very kludgily solved by simply stuffing nfsd and
mountd into the same process and using threads.  But it's obvious that
this approach doesn't get us very far.

Now, the first idea is to simply add routing capability to the libc
syscall stubs.  The fast path would still always trap into the kernel,
but in other cases system calls could be handled by a process-to-process
"trap", or in other words IPC.  This also easily gives us the ability
to handle syscalls over the network, should be want that.
(yes, I realize there's a whole wearhouse of clerical issues related to
this, such as security, how to decide which syscalls to route where etc.,
but let's keep the discussion on the big picture for now).

Does anyone have any better ideas?  I'll probably not start work on this
quite immediately, more like braise it for a while in the slow cooker.

  - antti


And then the ever-important userspace nfsd howto.  Running it doesn't
require any special kernel options, just a normal system.  nfsd accesses
the host system's file system namespace by doing a puffs null mount
inside the nfsd daemon (just trust me on that one ;).

1) get ftp://ftp.netbsd.org/pub/NetBSD/misc/pooka/rumpnfssvc.tar.gz
2) make sure stock rpcbind is running
3) make sure mountd and nfsd are NOT running
4) make sure you have pnullfs compiled (see rumpnfsd.c)
   (no, this does NOT require puffs support in the kernel)
5) compile and install sys/rump/fs/lib/libnfssserver
6) compile and run rumpnfsd
   - you need root unless your kernel is compiled with IPNOPRIVPORTS
     (could we please have that option as a toggle)
   - you need to set RUMP_THREADS=1 in your environment
7) mount_nfs regularly (or actually rump_nfs recommended, since the
   server might be crashy)

I probably forgot to mention something.  But that does matter, since
nobody read this far anyway.


Home | Main Index | Thread Index | Old Index