2001-07-23 15:42:44

by Roeland Th. Jansen

[permalink] [raw]
Subject: nfs weirdness


yesterday cleanly installed a system that is known to export three dirs
without problems with NFS on 2.2.16.

The system is at 2.4.4 (SuSE) and while the same exports file is used, I
get a problem that is identified with exportfs.

using knfsd, exports looks like :

/cdrom 192.168.1.2(ro)
/windows 192.168.1.2(ro)
/udf 192.168.1.2(ro)

exportfs -av with :

/dev/hdd on /udf type udf; /dev/hdc on /media/cdrom type iso9660 and
/windows is NOT mounted.

exporting 192.168.1.2:/media/cdrom
exporting 192.168.1.2:/windows
exporting 192.168.1.2:/udf
reexporting 192.168.1.2:/media/cdrom to kernel
reexporting 192.168.1.2:/windows to kernel
reexporting 192.168.1.2:/udf to kernel

looks good. remote mounts als shows no error :

toshiba:/cdrom 575506 575506 0 100% /tcdrom
toshiba:/windows 976216 895820 30804 97% /windows
toshiba:/udf 545984 530948 15036 98% /udf

except that /windows was NOT mounted so should be empty. it in fact
reflects the fs size, free etc of the root FS of toshiba. ls /windows on
192.168.1.2 shows no files.

now, if I mount /windows on toshiba, there are files. all ok, however,
exporting it causes :

reexporting 192.168.1.2:/windows to kernel
192.168.1.2:/windows: Invalid argument

(/dev/hda1 on /windows type vfat)

and mounting via nfs :

mount: toshiba:/windows failed, reason given by server: Permission
denied

/v/l/m shows :

rpc.mountd: authenticated mount request from 192.168.1.2:670 for /windows (/windows)
rpc.mountd: getfh failed: Operation not permitted

I'm lost, completely now. it worked with the old kernel/setup, now it
doesn't.

--
Grobbebol's Home | Don't give in to spammers. -o)
http://www.xs4all.nl/~bengel | Use your real e-mail address /\
Linux 2.2.16 SMP 2x466MHz / 256 MB | on Usenet. _\_v


2001-07-24 10:54:48

by NeilBrown

[permalink] [raw]
Subject: Re: nfs weirdness

On Monday July 23, [email protected] wrote:
>
> yesterday cleanly installed a system that is known to export three dirs
> without problems with NFS on 2.2.16.
>
> The system is at 2.4.4 (SuSE) and while the same exports file is used, I
> get a problem that is identified with exportfs.
>
> using knfsd, exports looks like :
>
> /cdrom 192.168.1.2(ro)
> /windows 192.168.1.2(ro)
> /udf 192.168.1.2(ro)
>
> exportfs -av with :
>
> /dev/hdd on /udf type udf; /dev/hdc on /media/cdrom type iso9660 and
> /windows is NOT mounted.
>
> exporting 192.168.1.2:/media/cdrom
> exporting 192.168.1.2:/windows
> exporting 192.168.1.2:/udf
> reexporting 192.168.1.2:/media/cdrom to kernel
> reexporting 192.168.1.2:/windows to kernel
> reexporting 192.168.1.2:/udf to kernel
>
> looks good. remote mounts als shows no error :
>
> toshiba:/cdrom 575506 575506 0 100% /tcdrom
> toshiba:/windows 976216 895820 30804 97% /windows
> toshiba:/udf 545984 530948 15036 98% /udf
>
> except that /windows was NOT mounted so should be empty. it in fact
> reflects the fs size, free etc of the root FS of toshiba. ls /windows on
> 192.168.1.2 shows no files.
>
> now, if I mount /windows on toshiba, there are files. all ok, however,
> exporting it causes :
>
> reexporting 192.168.1.2:/windows to kernel
> 192.168.1.2:/windows: Invalid argument
>
> (/dev/hda1 on /windows type vfat)
>
> and mounting via nfs :
>
> mount: toshiba:/windows failed, reason given by server: Permission
> denied
>
> /v/l/m shows :
>
> rpc.mountd: authenticated mount request from 192.168.1.2:670 for /windows (/windows)
> rpc.mountd: getfh failed: Operation not permitted
>
> I'm lost, completely now. it worked with the old kernel/setup, now it
> doesn't.

What you describe is exactly what I would expect. It might work
differently with unfsd - the user space nfs server, but this is all
correct for knfsd.

knfsd exports filesystems, or parts there-of. It doesn't export
'parts of the visible namespace'.

If you ask to export "/windows" and nothing is mounted on "/windows",
then you are asking to export part of the root filesystem starting at
"/windows". If you subsequently mount something on /windows, then you
haven't asked for that to be exported so it won't be, and mountd will
get confused.
You should always mount filesystems before trying to export them.

Now I appreciate that this could all be a bit more transparent, but
unfortunately it isn't and probably won't be for a while.

Possible changes to reduce the confusion:

1/ Don't allow a directory that is exported to be mounted on.
2/ Have a "mountpoint" export option which means "only export this
directory if it is a mountpoint".


Patches welcome.....

NeilBrown

2001-07-24 13:03:53

by Matt Bernstein

[permalink] [raw]
Subject: Re: nfs weirdness

At 20:54 +1000 Neil Brown wrote:

>knfsd exports filesystems, or parts there-of. It doesn't export
>'parts of the visible namespace'.
>
>If you ask to export "/windows" and nothing is mounted on "/windows",
>then you are asking to export part of the root filesystem starting at
>"/windows". If you subsequently mount something on /windows, then you
>haven't asked for that to be exported so it won't be, and mountd will
>get confused.
>You should always mount filesystems before trying to export them.

ISTR I had a setup where I had autofs mount some external drives and knfsd
export them, under Debian woody some months ago, and it all worked kind of
how I might expect (ie remote access could cause *my* volumes to be
mounted when I hadn't). Now I'm running RedHat and knfsd (or some init
script) mounts all my autofs volumes before exporting them.

I'm not grumbling 'cos everything's on journalling filesystems now :))

Matt

2001-07-26 19:39:17

by Roeland Th. Jansen

[permalink] [raw]
Subject: Re: nfs weirdness

On Tue, Jul 24, 2001 at 08:54:14PM +1000, Neil Brown wrote:
> If you ask to export "/windows" and nothing is mounted on "/windows",
> then you are asking to export part of the root filesystem starting at
> "/windows". If you subsequently mount something on /windows, then you
> haven't asked for that to be exported so it won't be, and mountd will
> get confused.
> You should always mount filesystems before trying to export them.


well, I tested it for trouble shooting. if I mount the /windows vfat and
export with knfsd it fails. if I do not moiut the vfat, it does. ergo,
the config files are okay, knfsd refuses.


somebody else pointed out in private mail that knfsd isn't supposed to
be able to export vfat filesystems and unfsd could. if he is correct, I
will have to onstall the other utils again and install unfsd instead.

--
Grobbebol's Home | Don't give in to spammers. -o)
http://www.xs4all.nl/~bengel | Use your real e-mail address /\
Linux 2.2.16 SMP 2x466MHz / 256 MB | on Usenet. _\_v

2001-07-26 20:47:20

by NeilBrown

[permalink] [raw]
Subject: Re: nfs weirdness

On Thursday July 26, [email protected] wrote:
> On Tue, Jul 24, 2001 at 08:54:14PM +1000, Neil Brown wrote:
> > If you ask to export "/windows" and nothing is mounted on "/windows",
> > then you are asking to export part of the root filesystem starting at
> > "/windows". If you subsequently mount something on /windows, then you
> > haven't asked for that to be exported so it won't be, and mountd will
> > get confused.
> > You should always mount filesystems before trying to export them.
>
>
> well, I tested it for trouble shooting. if I mount the /windows vfat and
> export with knfsd it fails. if I do not moiut the vfat, it does. ergo,
> the config files are okay, knfsd refuses.
>
>
> somebody else pointed out in private mail that knfsd isn't supposed to
> be able to export vfat filesystems and unfsd could. if he is correct, I
> will have to onstall the other utils again and install unfsd
> instead.

Yep, current kernels do not support exporting of FAT based filesystems.
There is a patch at:

http://www.cse.unsw.edu.au/~neilb/patches/linux/2.4.7/patch-E-fatnfs

that should fix this. I have done minimal testing, but I am waiting
for someone who actually needs to use this functionality to try it out
and confirm that it works for real-life situations before I recommend
it to Linus.

NeilBrown

2001-07-26 21:11:50

by Roeland Th. Jansen

[permalink] [raw]
Subject: Re: nfs weirdness

On Fri, Jul 27, 2001 at 06:46:52AM +1000, Neil Brown wrote:
> http://www.cse.unsw.edu.au/~neilb/patches/linux/2.4.7/patch-E-fatnfs
>
> that should fix this. I have done minimal testing, but I am waiting
> for someone who actually needs to use this functionality to try it out
> and confirm that it works for real-life situations before I recommend
> it to Linus.

I'll see what I can do to cross compile && install. I'll let you know in
a reasonable time.

--
Grobbebol's Home | Don't give in to spammers. -o)
http://www.xs4all.nl/~bengel | Use your real e-mail address /\
Linux 2.2.16 SMP 2x466MHz / 256 MB | on Usenet. _\_v