Subject: NFSv3 bugfixes/patches for NetBSD-current
To: None <rick@snowhite.cis.uoguelph.ca, tech-kern@NetBSD.ORG>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: tech-kern
Date: 03/29/1995 23:18:57
I tried the client and it seems to work OK (Modulo fixes below) on
NetBSD-current.  I'll give the server a whirl shortly.

Bug fixes below:

+ NetBSD-current fixes for kernel stuff
+ mount_nfs didn't like DEC OSF/1's answer:  it doesn't give any
  authenticators back to the mount request (its source comment says:
	An empty auth_flavors signifies that AUTH_UNIX is required.)
  Also, set errno before calling warn()  [it told me EADDRINUSE for
  these errors!]

For the README:

+ to build mount_nfs on NetBSD, you need to pick up the FreeBSD versions
  of mntopts.h and getmntopts.c
+ on NetBSD-current, you need to change the #ifdef KERNEL to #ifdef _KERNEL
  for nfs.h, nfsmount.h, nfsnode.h, nqnfs.h

==John Kohl

diff -rubw /usr/src/local/packages/nfsv3/sys/nfs/nfs_nqlease.c nfs/nfs_nqlease.c
--- /usr/src/local/packages/nfsv3/sys/nfs/nfs_nqlease.c	Mon Mar 27 14:43:52 1995
+++ sys/nfs/nfs_nqlease.c	Wed Mar 29 23:13:42 1995
@@ -1172,7 +1172,11 @@
 	 * Search the mount list for all nqnfs mounts and do their timer
 	 * queues.
 	 */
+#if NetBSD >= 1994101
+	for (mp = mountlist.cqh_first; mp != NULL; mp = mp->mnt_list.cqe_next) {
+#else
 	for (mp = mountlist.tqh_first; mp != NULL; mp = mp->mnt_list.tqe_next) {
+#endif
 #ifdef __NetBSD__
 		if (!strcmp(&mp->mnt_stat.f_fstypename[0], MOUNT_NFS)) {
 #else
diff -rubw /usr/src/local/packages/nfsv3/sys/nfs/nfs_vfsops.c nfs/nfs_vfsops.c
--- /usr/src/local/packages/nfsv3/sys/nfs/nfs_vfsops.c	Mon Mar 27 14:43:53 1995
+++ sys/nfs/nfs_vfsops.c	Wed Mar 29 23:14:15 1995
@@ -405,7 +405,11 @@
 
 	if (vfs_lock(mp))
 		panic("nfs_mountroot: vfs_lock");
+#if NetBSD >= 1994101
+	CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
+#else
 	TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
+#endif
 	mp->mnt_flag |= MNT_ROOTFS;
 	mp->mnt_vnodecovered = NULLVP;
 	vfs_unlock(mp);

===================================================================
RCS file: RCS/mount_nfs.c,v
retrieving revision 1.1
diff -ubw -r1.1 mount_nfs.c
--- 1.1	1995/03/30 02:22:47
+++ sbin/mount_nfs/mount_nfs.c	1995/03/30 04:07:14
@@ -66,8 +66,10 @@
 
 #include <nfs/rpcv2.h>
 #include <nfs/nfsproto.h>
+#define _KERNEL
 #define KERNEL
 #include <nfs/nfs.h>
+#undef _KERNEL
 #undef KERNEL
 #include <nfs/nqnfs.h>
 
@@ -673,6 +675,7 @@
 	if (nfhret.stat) {
 		if (opflags & ISBGRND)
 			exit(1);
+		errno = nfhret.stat;	/* XXX */
 		warn("can't access %s", spec);
 		return (0);
 	}
@@ -735,7 +738,7 @@
 			if (auth == np->auth)
 				authfnd++;
 		}
-		if (!authfnd)
+		if (!authfnd && authcnt > 0)
 			np->stat = EAUTH;
 		return (1);
 	};