Subject: kern/14817: NFS_V2_ONLY doesn't work
To: None <gnats-bugs@gnats.netbsd.org>
From: Gregory McGarry <g.mcgarry@ieee.org>
List: netbsd-bugs
Date: 12/03/2001 19:21:13
>Number:         14817
>Category:       kern
>Synopsis:       NFS_V2_ONLY doesn't work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 02 22:22:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Gregory McGarry
>Release:        NetBSD-current
>Organization:
>Environment:

NetBSD-current

>Description:

NFS_V2_ONLY doesn't seem to work.  I didn't notice when this happened.

>How-To-Repeat:

compile with kernel option NFS_V2_ONLY

>Fix:

This is a fix, but according to the comments in the files, the functions
which invoke nfs_fsinfo() are version 3 specific anyway.

Index: nfs_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.111
diff -u -r1.111 nfs_vfsops.c
--- nfs_vfsops.c	2001/11/10 10:59:10	1.111
+++ nfs_vfsops.c	2001/12/03 06:01:04
@@ -160,8 +160,10 @@
 	vp = nmp->nm_vnode;
 	cred = crget();
 	cred->cr_ngroups = 0;
+#ifndef NFS_V2_ONLY
 	if (v3 && (nmp->nm_iflag & NFSMNT_GOTFSINFO) == 0)
 		(void)nfs_fsinfo(nmp, vp, cred, p);
+#endif
 	nfsstats.rpccnt[NFSPROC_FSSTAT]++;
 	nfsm_reqhead(vp, NFSPROC_FSSTAT, NFSX_FH(v3));
 	nfsm_fhtom(vp, v3);
Index: nfs_vnops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/nfs/nfs_vnops.c,v
retrieving revision 1.143
diff -u -r1.143 nfs_vnops.c
--- nfs_vnops.c	2001/11/10 10:59:10	1.143
+++ nfs_vnops.c	2001/12/03 06:01:04
@@ -2908,14 +2908,16 @@
 	} */ *ap = v;
 	struct nfsv3_pathconf *pcp;
 	struct vnode *vp = ap->a_vp;
-	struct nfsmount *nmp;
 	struct mbuf *mreq, *mrep, *md, *mb, *mb2;
 	int32_t t1, t2;
 	u_int32_t *tl;
 	caddr_t bpos, dpos, cp, cp2;
 	int error = 0, attrflag;
+#ifndef NFS_V2_ONLY
+	struct nfsmount *nmp;
 	unsigned int l;
 	u_int64_t maxsize;
+#endif
 	const int v3 = NFS_ISV3(vp);
 
 	switch (ap->a_name) {
@@ -2966,6 +2968,7 @@
 		nfsm_reqdone;
 		break;
 	case _PC_FILESIZEBITS:
+#ifndef NFS_V2_ONLY
 		if (v3) {
 			nmp = VFSTONFS(vp->v_mount);
 			if ((nmp->nm_iflag & NFSMNT_GOTFSINFO) == 0)
@@ -2976,7 +2979,9 @@
 			    (maxsize >> l) > 0; l++)
 				;
 			*ap->a_retval = l + 1;
-		} else {
+		} else
+#endif
+		{
 			*ap->a_retval = 32;	/* NFS V2 limitation */
 		}
 		break;


>Release-Note:
>Audit-Trail:
>Unformatted: