Re: exports option "mountpoint" ignored in nfsv4, works in v3

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

 



On 2 Jun 2024, at 22:43, Matt Kinni wrote:

> Wasn't sure if this was a bug or just an outdated manpage, but the
> "mountpoint" option will _not_ stop a v4 client from mounting an
> unmounted server directory in Fedora 40 with kernel 6.8.10-300 and
> nfs-utils-2.6.4-0.rc6.fc40.x86_64, however it _does_ work as expected if
> the client mounts with v3 instead:
>
> # setup
> mkdir /mnt/nfs_localhost && mkdir /srv/somemountpoint
> chmod 777 /srv/somemountpoint
>
> # in /etc/exports:
> /srv                    *(rw,all_squash,fsid=0)
> /srv/somemountpoint     *(rw,all_squash,mountpoint)
>
> # in /etc/nfs.conf:
> [nfsd]
> port=20049
> vers3=y
> vers4=y
>
> # try mounting with nfs v3 while /srv/somemountpoint is a plain dir:
> mount localhost:/srv/somemountpoint /mnt/nfs_localhost -t nfs -o vers=3
>
> (cmd output)> mount.nfs: mounting localhost:/srv/somemountpoint failed,
> reason given by server: No such file or directory
> (log says)> rpc.mountd[5313]: request to export an unmounted filesystem:
> /srv/somemountpoint
>
> # so far so good
> # but now try doing the same thing with v4:
> mount localhost:/somemountpoint /mnt/nfs_localhost -t nfs -o vers=4.2
> (works without error)
>
> If I `mount -o bind /tmp /srv/somemountpoint` the v3 command works as
> expected, but the v4 command always works regardless of whether the
> underlying folder is a mount point or not.  Is this intended behavior?
>
> The exports(5) manpage does not say anything about the "mountpoint" or
> "mp" options not being valid for NFSv4, so I would expect the same
> behavior regardless of what "-o vers=..." is supplied by the client
> mount command.

Hey Matt -
I suspect think the option is working properly.  Its not that
/srv/somemountpoint is always being exported, its that the v4 mount is
mounting the root (/srv) and walking into /srv/somemountpoint.

If you're exporting /srv, /srv/somemountpoint going to be accessible.

Maybe we need to update the manpage to clear up confusion there?

Ben





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux