Subject: kern/1917: Direct mounts don't work with amd
To: None <gnats-bugs@gnats.netbsd.org>
From: David Mazieres <dm@uun.org>
List: netbsd-bugs
Date: 01/08/1996 14:08:09
>Number:         1917
>Category:       kern
>Synopsis:       Direct mounts don't work with amd
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan  8 14:20:01 1996
>Last-Modified:
>Originator:     David Mazieres
>Organization:
	
>Release:        Jan 8, 1996
>Environment:
	486 PC
System: 486 PC


>Description:
	Direct mounts are broken, because the kernel can't NFS
	mount a symlink, only a directory.
>How-To-Repeat:
	Create a file amd.test with, for example, the following line:
		usr/test        type:=link;fs:=/usr/src/sys/arch
	Then give the command
		amd /usr/test amd.test -type:=direct
	Try to cd /usr/test, and ls -al.  You will get a stale NFS
	file handle error.
>Fix:
Index: sys/nfs/nfs_bio.c
===================================================================
RCS file: /cvs/src/sys/nfs/nfs_bio.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -b -u -r1.1.1.1 -r1.2
--- nfs_bio.c	1995/10/18 08:53:21	1.1.1.1
+++ nfs_bio.c	1996/01/08 07:36:23	1.2
@@ -167,7 +167,11 @@
 			return (error);
 		}
 	    }
-	    if (np->n_flag & NQNFSNONCACHE) {
+	    /*
+	     * Don't cache magic amd symlinks.
+	     */
+	    if (np->n_flag & NQNFSNONCACHE
+		|| ((vp->v_flag & VROOT) && vp->v_type == VLNK)) {
 		switch (vp->v_type) {
 		case VREG:
 			error = nfs_readrpc(vp, uio, cred);
Index: sys/nfs/nfs_subs.c
===================================================================
RCS file: /cvs/src/sys/nfs/nfs_subs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -u -r1.2 -r1.3
--- nfs_subs.c	1995/12/21 14:42:24	1.2
+++ nfs_subs.c	1996/01/08 07:36:26	1.3
@@ -698,7 +698,7 @@
 	 * information.
 	 */
 	np = VTONFS(vp);
-	if (vp->v_type == VNON) {
+	if (vp->v_type != vtyp) {
 		if (vtyp == VCHR && rdev == 0xffffffff)
 			vp->v_type = vtyp = VFIFO;
 		else
Index: sys/nfs/nfs_vfsops.c
===================================================================
RCS file: /cvs/src/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -u -r1.3 -r1.4
--- nfs_vfsops.c	1995/12/21 14:42:26	1.3
+++ nfs_vfsops.c	1996/01/08 07:36:28	1.4
@@ -486,6 +486,7 @@
 	register struct nfsmount *nmp;
 	struct nfsnode *np;
 	int error;
+	struct vattr attrs;
 
 	if (mp->mnt_flag & MNT_UPDATE) {
 		nmp = VFSTONFS(mp);
@@ -565,6 +566,7 @@
 	if (error = nfs_nget(mp, &nmp->nm_fh, &np))
 		goto bad;
 	*vpp = NFSTOV(np);
+	VOP_GETATTR(*vpp, &attrs, curproc->p_ucred, curproc);
 
 	return (0);
 bad:
@@ -664,6 +666,7 @@
 	if (error = nfs_nget(mp, &nmp->nm_fh, &np))
 		return (error);
 	vp = NFSTOV(np);
+	if (vp->v_type == VNON)
 	vp->v_type = VDIR;
 	vp->v_flag = VROOT;
 	*vpp = vp;
Index: usr.sbin/amd/config/os-bsd44.h
===================================================================
RCS file: /cvs/src/usr.sbin/amd/config/os-bsd44.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -b -u -r1.1.1.1 -r1.2
--- os-bsd44.h	1995/10/18 08:47:14	1.1.1.1
+++ os-bsd44.h	1996/01/08 07:36:31	1.2
@@ -196,3 +196,8 @@
  */
 #undef RE_HDR
 #define RE_HDR <regexp.h>
+
+/*
+ * Need precise length links
+ */
+#define	PRECISE_SYMLINKS
>Audit-Trail:
>Unformatted: