Re: autofs + default /net map + NFS4 — how to?

Rick Macklem rmacklem at uoguelph.ca
Thu May 13 21:00:01 UTC 2021


lev wrote:
>  I have server, named "blob", which exports some shares via NFSv4:
>
>/usr                    -maproot 0:0 -network 192.168.134.0 -mask 255.255.255.0
>... <snip 4 more records for /usr for different networks> ...
>/usr/ports              -maproot 0:0 -network 192.168.134.0 -mask 255.255.255.0
>/usr/ports/distfiles    -maproot 0:0 -network 192.168.134.0 -mask 255.255.255.0
>/usr/home               -maproot 0:0 -network 192.168.134.0 -mask 255.255.255.0
>/usr/home/lev           -maproot 0:0 -network 192.168.134.0 -mask 255.255.255.0
>... <snip all other home directories> ...
>V4:     /usr    -sec=sys -network 192.168.134.0 -mask 255.255.255.0
>... <snip 4 more records for V4 for different networks> ...
>
>(it is shame, that I need to enumerate all home directories separately, for each my network!)
You can do the exports lines without "-network..." and then they apply to all subnets.
Not recommended unless you have an external firewall/nat gateway that is blocking
incoming traffic to port#2049.

>So, NFSv4 uses "/usr" as export root and exports shares with stripped "/usr" prefix ("/home", /ports" not "/usr/home", >"/usr/ports").
>
>I could mount "blob:/home" or "blob:/ports" with mount -t nfs like this:
>
># mount -t nfs -o nfsv4,tcp blob:/home /mnt
># ls /mnt
>.... lev ....
># umount /mnt
># ls /mnt
>#
>
> No problem, it works.
>
>I've added "nfsv4,tcp" options to "/net" map in "/etc/auto_master", run "automount" and try:
>
># cd /net/blob/home
>/net/blob/home: No such file or directory
># ls /net
>blob
># ls /net/blob
>usr
># cd /net/blob/usr/home
>WARNING: autofs_trigger_one: request for /net/blob/usr/ completed with error 5, pid 1519 (csh)
>May 13 23:05:15 hamster automountd[2564]: mount failed
>... <snip 4 more repitions of the same> ...
>/net/blob/usr/home: Input/output error
>#
>
>Looks like it is because "autofs" uses "showmount -E" to determine available mount points, and "showmount" shows >NFSv3 mounts, which conflicts with NFSv4.
I know nothing about autofs and never use it. (/etc/fstab is your friend;-)
However, if it is using "showmount -E" (an RPC for the Mount protocol that is an auxiliary
to NFSv3) for NFSv4 then, yes, it is broken.
--> It should either "just try the mount" or do the following NFSv4 compound RPC:
      PutRootFH
      Lookup <dir>
      ... for each directory in mount path
      Getattr
     - If the above succeeds (NFS_OK) and the getattr reply shows the type as DIR,
       then that is roughly the same as above (although it might work even when the
       directory is not exported, so it probably is not worth the effort and just trying
       the mount would be better, I think?

>Should it work out-of-the-box? Or I need to custom-fix script in "/etc/autofs" (I don't like this idea!)
I suspect changing your V4: lines to specify "/" may work around this, since the
mount paths then look the same as for NFSv3.

rick

--
// Lev Serebryakov
_______________________________________________
freebsd-fs at freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"



More information about the freebsd-fs mailing list