9fans archive / 1998 / 07 / 31 /    prev next

From: Russ Cox rsc@pla...
Subject: [9fans] nfsserver
Date: Sat, 25 Jul 1998 18:23:43 -0400

I use the following to export a file tree from kfs to
DOS via NFS (it would work for Unix too...).

rm -f /srv/usaco
srvfs usaco /usr/rsc/usaco
aux/nfsserver -f /srv/usaco -c /lib/ndb/nfs >/sys/log/nfschat >[2=1]
aux/portmapper >/sys/log/portmapchat >[2=1]
aux/pcnfsd -c /lib/ndb/nfs >/sys/log/pcnfsdchat >[2=1]

The srvfs stuff gets me the tree /usr/rsc/usaco served by /srv/usaco.
Then the -f option to nfsserver serves this tree via NFS.

You could try
	mount -c /srv/kfs /n/kfs
	srvfs kfsroot /
	aux/nfsserver -f /srv/kfsroot ...

Note that you can't do "aux/nfsserver -f /srv/kfs",
since nfsserver reads and writes messages to the file you give
it, instead of using mount(2).  Since your kernel is already using
/srv/kfs, the fids that nfsserver picks are likely to conflict 
with the fids that the kernel is using.  In fact, I think you might
not even be able to do any file i/o to /srv/kfs, for this very
reason.  Once /srv stuff gets mounted, the kernel prohibits you 
from doing read/write operations yourself, so you don't interfere
with the kernel.

There are two problems with using srvfs.  One is that it's slightly
buggy and nfsserver exercises those bugs.  I'll post an appropriate
fix soon if you're interested. 

The second, more serious problem is that srvfs turns off permission
checking: all access via /srv/kfsroot would be done as if it was 
being done by the user that ran srvfs.  So in my above example, all
access via the NFS client to the files in /usr/rsc/usaco is done acting
as rsc (who ran the srvfs command) no matter who NFS mounts the file
system.  In my case, I don't care since I'm exporting it to one DOS
machine that I control.  In a less friendly environment, you probably
care a lot more.

I think Richard Miller had some boddles that let you have kfs serve
files via the usual IL port, i.e. act as a file server.  If you apply
those, then you could do
	aux/nfsserver -a il!yourmachine 
and both of the problems I mentioned with srvfs are of no concern,
since you're not using it.  That might be the best solution, short of
setting up your own file server.

Russ