2006-05-29 18:24:12

by Theo Markettos

[permalink] [raw]
Subject: Multiple heterogeneous NFS servers on one machine

I need to run two different NFS servers on the same 2.6 Linux machine. This
is because I need the --re-export option from Debian's 'nfs-user-server'
package, and I also need an NFS 3 server, for which I'm using Linux's kernel
mode server. I've been trying to work out a way of doing this.

My NFS clients can be told which ports mountd and nfsd are listening on, so
it should be straightforward. However I can't seem to get portmap out of
the equation. When I run just the kernel server, it works. It also works
if I tell my client explicitly which ports the kernel server mountd/nfsd are
listening on. However if I run just mountd and nfsd from the user mode
server, without portmap, my client is giving RPC failures. More confusingly
if I run them when the kernel server is also running, neither work. Killing
user mode nfsd makes the kernel server work again.

So I think something is breaking portmap. I've hacked the source of the
user mode server mountd/nfsd to not call svc_register() (see man 3 rpc) in
an attempt to not confuse portmap with two NFS servers running at once.
This at least means the kernel server works, but the user mode server
doesn't.

I'm still getting RPC errors when I run user mode mountd/nfsd without the
kernel server after this modification, and running portmap doesn't help.

Is it possible to run NFS without portmap? Or are there any other
suggestions for running two NFS servers on the same machine? I thought
about giving the machine two IP addresses, but neither server has an option
to listen on a specific interface. Or is there some way that the kernel NFS
server can export already mounted remote directories (ie machine B exports
directory containing filesystem mounted from machine A, where machine A's
directory may be mounted with some random non-NFS network filesystem), which
was the need for --re-export in the first place?

Thanks
Theo

--
Theo Markettos [email protected]
Clare Hall, Cambridge [email protected]
CB3 9AL, UK http://www.markettos.org.uk/


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2006-05-29 18:50:23

by Peter Åstrand

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine


> I need to run two different NFS servers on the same 2.6 Linux machine. This
> is because I need the --re-export option from Debian's 'nfs-user-server'
> package, and I also need an NFS 3 server, for which I'm using Linux's kernel
> mode server. I've been trying to work out a way of doing this.

> Is it possible to run NFS without portmap?

Sure. With unfs3, just use the "-p" option. You can use the same or
different ports for the NFS and MOUNT service. Typically, I run unfs3
with:

unfsd -n 4711 -m 4711 -p

When mounting you need to use the port= and mountport= options.

Kind regards,
--
Peter ?strand ThinLinc Chief Developer
Cendio http://www.cendio.se
Teknikringen 3
583 30 Link?ping Phone: +46-13-21 46 00

2006-05-29 19:18:54

by Theo Markettos

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine

On Mon, May 29, 2006 at 08:50:14PM +0200, Peter ?strand wrote:
>
> >Is it possible to run NFS without portmap?
>
> Sure. With unfs3, just use the "-p" option. You can use the same or
> different ports for the NFS and MOUNT service. Typically, I run unfs3
> with:
>
> unfsd -n 4711 -m 4711 -p

Which is interesting, because I tried unfs3 (giving them distinct port
numbers for NFS and MOUNT) and got:

shepherd:~# mount -t nfs -o port=1299,mountport=1289,tcp ordovician:/nc /mnt/

mount: ordovician:/nc failed, reason given by server: unknown nfs status
return value: 22

The same happened if I tried to mount from the local machine, or tried udp.
At this point I gave up with unfs3. Any suggestions as to why that error is
happening?

Theo


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-05-29 19:36:37

by Bernd Schubert

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine

> shepherd:~# mount -t nfs -o port=3D1299,mountport=3D1289,tcp ordovician:=
/nc
> /mnt/
>
> mount: ordovician:/nc failed, reason given by server: unknown nfs status
> return value: 22
>
> The same happened if I tried to mount from the local machine, or tried ud=
p.
> At this point I gave up with unfs3. Any suggestions as to why that error
> is happening?

Anything in the logs of the Server? If the problem persist, can you could=20
start unfsd with '-p', so that it does't detach from the terminal.
Whats are your current unfs3 options? Have you already tried to put port a=
nd=20
mountport on the same portnumber (with unfs3 its suggested anyway).

You may also want to read:

http://www.pci.uni-heidelberg.de/tc/usr/bernd/downloads/nfs-root-howto/disk=
less-nfs-howto.txt

If you find something need to be explained more in detail, just tell me.


Cheers,
Bernd



=2D-=20
Bernd Schubert
PCI / Theoretische Chemie
Universit=E4t Heidelberg
INF 229
69120 Heidelberg



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-05-29 19:51:51

by Peter Åstrand

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine

On Mon, 29 May 2006, Bernd Schubert wrote:

>> At this point I gave up with unfs3. Any suggestions as to why that error
>> is happening?
>
> Anything in the logs of the Server? If the problem persist, can you could
> start unfsd with '-p', so that it does't detach from the terminal.

That's the '-d' option.

Regards,
--
Peter ?strand ThinLinc Chief Developer
Cendio http://www.cendio.se
Teknikringen 3
583 30 Link?ping Phone: +46-13-21 46 00

2006-05-29 20:42:59

by Theo Markettos

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine

On Mon, May 29, 2006 at 09:36:16PM +0200, Bernd Schubert wrote:
> Anything in the logs of the Server? If the problem persist, can you could
> start unfsd with '-p', so that it does't detach from the terminal.
> Whats are your current unfs3 options? Have you already tried to put port and
> mountport on the same portnumber (with unfs3 its suggested anyway).

OK, I get:
ordovician:/tmp/nfs-user-server-2.2beta47# unfsd -n 1599 -m 1599 -p -d
UNFS3 unfsd 0.9.13 (C) 2004 Pascal Schmidt <[email protected]>
/home: ip 172.21.115.2 mask 255.255.255.255 options 4
/home: ip 127.0.0.1 mask 255.255.255.255 options 4
/nc: ip 172.21.115.0 mask 255.255.255.0 options 2
/: ip 172.21.115.2 mask 255.255.255.255 options 2
/store: ip 172.21.115.2 mask 255.255.255.255 options 4
/store: ip 127.0.0.1 mask 255.255.255.255 options 4
172.21.115.14 attempted mount with unsupported protocol version
172.21.115.12 attempted mount with unsupported protocol version

(tried the command I posted from two different machines)

If I append ,nfsvers=3 to the mount options, it hangs for about 5-10 mins
then succeeds without further log output. (Linux 2.4.26 and 2.6.15.4
respectively, both Debian stable).

If I try to connect from the NFS client on my RISC OS machine it says "NFS
call failed (Operation is not supported)" which looking at the source means
it's got a code 10004, NFSERR_NOTSUPP, from the RPC mechanism. That's with
it in NFS 3 mode - in NFS 2 mode it just says "Unknown error" which, when I
make it output the number, is 22. I have the source for this client so I
can make it output more information if you can suggest what would be of
help.

> You may also want to read:
>
> http://www.pci.uni-heidelberg.de/tc/usr/bernd/downloads/nfs-root-howto/diskless-nfs-howto.txt

Thanks, that's very useful. Sounds like unfs is the way to go, if only I
can persuade it to work with my clients.

Theo


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-05-29 21:15:33

by Bernd Schubert

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine

>
> OK, I get:
> ordovician:/tmp/nfs-user-server-2.2beta47# unfsd -n 1599 -m 1599 -p -d
> UNFS3 unfsd 0.9.13 (C) 2004 Pascal Schmidt <[email protected]>
> /home: ip 172.21.115.2 mask 255.255.255.255 options 4
> /home: ip 127.0.0.1 mask 255.255.255.255 options 4
> /nc: ip 172.21.115.0 mask 255.255.255.0 options 2
> /: ip 172.21.115.2 mask 255.255.255.255 options 2
> /store: ip 172.21.115.2 mask 255.255.255.255 options 4
> /store: ip 127.0.0.1 mask 255.255.255.255 options 4
> 172.21.115.14 attempted mount with unsupported protocol version
> 172.21.115.12 attempted mount with unsupported protocol version
>
> (tried the command I posted from two different machines)

Can you add mountvers=3D3,nolock as described in my howto?=20

>
> If I append ,nfsvers=3D3 to the mount options, it hangs for about 5-10 mi=
ns
> then succeeds without further log output. (Linux 2.4.26 and 2.6.15.4
> respectively, both Debian stable).

If it still waits this long time, after adding the options above, could you=
=20
capture via ethereal and look whats going on? The nfsvers=3D3 option is als=
o=20
still important as the default option is nfsvers=3D2, which is not supporte=
d by=20
unfs3.=20

>
> If I try to connect from the NFS client on my RISC OS machine it says "NFS
> call failed (Operation is not supported)" which looking at the source mea=
ns
> it's got a code 10004, NFSERR_NOTSUPP, from the RPC mechanism. That's wi=
th
> it in NFS 3 mode - in NFS 2 mode it just says "Unknown error" which, when=
I
> make it output the number, is 22. I have the source for this client so I
> can make it output more information if you can suggest what would be of
> help.

An ethereal capture (and the sources ) would be helpfull in that case. My n=
fs=20
protocol knowlegde got a bit rosty, but I need to refresh it anyway to fini=
sh=20
my pending patches for unfs3 (if I only had the time to write them :( )

>
> > You may also want to read:
> >
> > http://www.pci.uni-heidelberg.de/tc/usr/bernd/downloads/nfs-root-howto/=
di
> >skless-nfs-howto.txt
>
> Thanks, that's very useful. Sounds like unfs is the way to go, if only I
> can persuade it to work with my clients.

Cheers,
Bernd


=2D-=20
Bernd Schubert
PCI / Theoretische Chemie
Universit=E4t Heidelberg
INF 229
69120 Heidelberg



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-05-31 11:43:01

by Theo Markettos

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine

On Mon, May 29, 2006 at 11:15:23PM +0200, Bernd Schubert wrote:
> >
> Can you add mountvers=3,nolock as described in my howto?

Ah, thanks. That succeeds instantly.

> > If I try to connect from the NFS client on my RISC OS machine it says "NFS
> > call failed (Operation is not supported)" which looking at the source means
> > it's got a code 10004, NFSERR_NOTSUPP, from the RPC mechanism. That's with
> > it in NFS 3 mode - in NFS 2 mode it just says "Unknown error" which, when I
> > make it output the number, is 22. I have the source for this client so I
> > can make it output more information if you can suggest what would be of
> > help.
>
> An ethereal capture (and the sources ) would be helpfull in that case. My nfs
> protocol knowlegde got a bit rosty, but I need to refresh it anyway to finish
> my pending patches for unfs3 (if I only had the time to write them :( )

OK, Ethereal capture can be found at:
http://www.harbinge.com/temp/nfs-ethereal.libpcap (raw dump file)
http://www.harbinge.com/temp/nfs-ethereal.txt (text explanation)

Briefly, the client is 172.21.115.2 (iapetus) and the server 172.21.115.12
(ordovician). There a bit of random ARP and broadcast traffic in there too
that I didn't manage to filter out. Both NFS and MOUNT were listening on
port 1599.

Source is in:
http://www.harbinge.com/temp/sunfish-108.zip

For historical reasons files are named c/foo rather than foo.c. Much of the
RPC code is generated by perl script ProcessSpec from XDR specifications
(see makefile) - I've put the output .c and .h files in the archive so it's
easier for you to poke around. Function names in caps are usually RPC calls.

The code that initiates the connection is func_newimage() in
imageentry_newimage.c. This then calls
imageentry_func.c/func_newimage_mount() that calls MOUNT.

Another entry point I think then calls imageentry_func.c/func_readdirinfo()
that calls imageentry_common.c/filename_to_finfo() which fires off some
LOOKUP commands. Then back in func_readdirinfo() we call READDIRPLUS which
gives up back error 10004.

Aha, right. It seems unfs3 doesn't support READDIRPLUS. I'll see if the
client can be modified to call READDIR only.

Thanks
Theo


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-05-31 19:44:36

by Trond Myklebust

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine

On Wed, 2006-05-31 at 12:42 +0100, Theo Markettos wrote:
> On Mon, May 29, 2006 at 11:15:23PM +0200, Bernd Schubert wrote:
> > >
> > Can you add mountvers=3,nolock as described in my howto?
>
> Ah, thanks. That succeeds instantly.
>
> > > If I try to connect from the NFS client on my RISC OS machine it says "NFS
> > > call failed (Operation is not supported)" which looking at the source means
> > > it's got a code 10004, NFSERR_NOTSUPP, from the RPC mechanism. That's with
> > > it in NFS 3 mode - in NFS 2 mode it just says "Unknown error" which, when I
> > > make it output the number, is 22. I have the source for this client so I
> > > can make it output more information if you can suggest what would be of
> > > help.
> >
> > An ethereal capture (and the sources ) would be helpfull in that case. My nfs
> > protocol knowlegde got a bit rosty, but I need to refresh it anyway to finish
> > my pending patches for unfs3 (if I only had the time to write them :( )
>
> OK, Ethereal capture can be found at:
> http://www.harbinge.com/temp/nfs-ethereal.libpcap (raw dump file)
> http://www.harbinge.com/temp/nfs-ethereal.txt (text explanation)
>
> Briefly, the client is 172.21.115.2 (iapetus) and the server 172.21.115.12
> (ordovician). There a bit of random ARP and broadcast traffic in there too
> that I didn't manage to filter out. Both NFS and MOUNT were listening on
> port 1599.
>
> Source is in:
> http://www.harbinge.com/temp/sunfish-108.zip
>
> For historical reasons files are named c/foo rather than foo.c. Much of the
> RPC code is generated by perl script ProcessSpec from XDR specifications
> (see makefile) - I've put the output .c and .h files in the archive so it's
> easier for you to poke around. Function names in caps are usually RPC calls.
>
> The code that initiates the connection is func_newimage() in
> imageentry_newimage.c. This then calls
> imageentry_func.c/func_newimage_mount() that calls MOUNT.
>
> Another entry point I think then calls imageentry_func.c/func_readdirinfo()
> that calls imageentry_common.c/filename_to_finfo() which fires off some
> LOOKUP commands. Then back in func_readdirinfo() we call READDIRPLUS which
> gives up back error 10004.
>
> Aha, right. It seems unfs3 doesn't support READDIRPLUS. I'll see if the
> client can be modified to call READDIR only.

_IF_ unfs3 is returning the correct error when we call READDIRPLUS (i.e.
NFS3ERR_NOTSUP == 10004), then the client will already automatically
fall back to using READDIR only.

Trond



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-06-01 20:37:40

by Theo Markettos

[permalink] [raw]
Subject: Re: Multiple heterogeneous NFS servers on one machine

On Wed, May 31, 2006 at 03:09:48PM -0400, Trond Myklebust wrote:
> _IF_ unfs3 is returning the correct error when we call READDIRPLUS (i.e.
> NFS3ERR_NOTSUP == 10004), then the client will already automatically
> fall back to using READDIR only.

Exactly, but it isn't. It (Sunfish) is just reporting the error then giving
up. I've asked the author and he says it wouldn't be too hard to modify the
client to use READDIR all the time, except for a performance hit, but it
would be harder to make it fall back. I'm going to have a look at how I can
modify it when I next have some spare time.

Theo


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs