>Synopsis: amd(8) does not support nfsv3
>Category: system, user
>Environment:
System : OpenBSD 5.6
Details : OpenBSD 5.6-current (GENERIC.MP) #735: Sat Dec 27
13:55:58 MST 2014
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
Architecture: OpenBSD.amd64
Machine : amd64
>Description:
amd(8) will always use NFS version 2. mount_nfs(8) defaults to version 3
(but is configurable), so amd(8) should too.
>How-To-Repeat:
Configure amd to mount an NFS filesystem, and observe that it does so
using the version 2 protocol only.
>Fix:
Patch attached. When applied, amd will default to NFS version 3, and
may be configured to use version 2 with the mount option nfsv2 (similar to
mount_nfs). I did not implement the logic to fallback to version 2 mounts if
version 3 fails, which is present in mount_nfs.
--
Lauri Tirkkonen | +358 50 5341376 | lotheac @ IRCnet
Index: amd/nfs_ops.c
===================================================================
RCS file: /OpenBSD/src/usr.sbin/amd/amd/nfs_ops.c,v
retrieving revision 1.26
diff -u -p -r1.26 nfs_ops.c
--- amd/nfs_ops.c 26 Oct 2014 03:28:41 -0000 1.26
+++ amd/nfs_ops.c 5 Jan 2015 19:56:25 -0000
@@ -500,6 +500,7 @@ mount_nfs_fh(fhstatus *fhp, char *dir, c
nfs_args.fh = (void *)fhp->fhs_fhandle;
nfs_args.fhsize = fhp->fhs_size;
nfs_args.version = NFS_ARGSVERSION;
+ nfs_args.flags |= NFSMNT_NFSV3;
nfs_args.hostname = host;
#ifdef HOSTNAMESZ
@@ -606,7 +607,13 @@ mount_nfs_fh(fhstatus *fhp, char *dir, c
if (hasmntopt(&mnt, "tcp") != NULL)
nfs_args.sotype = SOCK_STREAM;
-
+ if (hasmntopt(&mnt, "nfsv2") != NULL) {
+ if (hasmntopt(&mnt, "nfsv3") == NULL)
+ nfs_args.flags &= ~NFSMNT_NFSV3;
+ else
+ plog(XLOG_USER, "Mount opts nfsv2 and nfsv3 are "
+ "mutually exclusive, using nfsv3");
+ }
error = mount_fs(&mnt, flags, (caddr_t) &nfs_args, retry, type);
free(xopts);
Index: doc/amdref.texinfo
===================================================================
RCS file: /OpenBSD/src/usr.sbin/amd/doc/amdref.texinfo,v
retrieving revision 1.12
diff -u -p -r1.12 amdref.texinfo
--- doc/amdref.texinfo 24 Oct 2014 10:29:56 -0000 1.12
+++ doc/amdref.texinfo 5 Jan 2015 19:56:26 -0000
@@ -1366,6 +1366,10 @@ Use NFS compression protocol.
Use BSD directory group-id semantics.
@item intr
Allow keyboard interrupts on hard mounts.
+@item nfsv2
+Use NFS version 2 protocol.
+@item nfsv3
+Use NFS version 3 protocol (the default).
@item noconn
Don't make a connection on datagram transports.
@item nocto