Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Aug 1995 19:34:19 +0100 (BST)
From:      Doug Rabson <dfr@render.com>
To:        Thomas Graichen <graichen@sirius.physik.fu-berlin.de>
Cc:        hackers@freebsd.org, davidg@freebsd.org
Subject:   Re: PLEASE help me to get broken FreeBSD automounter working PLEASE !!!
Message-ID:  <Pine.BSF.3.91.950810192533.4478X-100000@minnow.render.com>
In-Reply-To: <9508101213.AA04318@sirius.physik.fu-berlin.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 10 Aug 1995, Thomas Graichen wrote:

> i've tried all version i was able to find - the NetBSD and the Linux one
> (maybe one of them has the problem fixed) and the upl102 too - all show the
> same problem - can please someone look into my debugging stuff and try to find
> the problem there - i'll try to help as much as i can (i'll now try a -current
> kernel and amd)

Well it turns out that amd direct maps are implemented my amd mounting a 
filehandle which represents a symlink (normally one mounts directories).  
This turned up no less than three bugs:

1. The nfs client code ignored the type of the object being mounted and 
assumed it was a directory.
2. The vfs pathname parsing couldn't cope with the root of a mountpoint 
being a symlink instead of a directory.
3. NFS cached the result of looking up the link, defeating the amd mount 
timeout code.

This patch to -current seems to allow amd direct maps to work.  Use with 
care - it has had minimal testing and it touches fundamental system code.
Index: nfs/nfs_bio.c
===================================================================
RCS file: /home/ncvs/src/sys/nfs/nfs_bio.c,v
retrieving revision 1.16
diff -c -r1.16 nfs_bio.c
*** 1.16	1995/07/07 11:01:30
--- nfs_bio.c	1995/08/10 18:15:30
***************
*** 183,189 ****
  			return (error);
  		}
  	    }
! 	    if (np->n_flag & NQNFSNONCACHE) {
  		switch (vp->v_type) {
  		case VREG:
  			return (nfs_readrpc(vp, uio, cred));
--- 183,193 ----
  			return (error);
  		}
  	    }
! 	    /*
! 	     * 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:
  			return (nfs_readrpc(vp, uio, cred));
Index: nfs/nfs_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.17
diff -c -r1.17 nfs_vfsops.c
*** 1.17	1995/07/07 11:01:31
--- nfs_vfsops.c	1995/08/10 18:13:47
***************
*** 542,547 ****
--- 542,548 ----
  	register struct nfsmount *nmp;
  	struct nfsnode *np;
  	int error, maxio;
+ 	struct vattr attrs;
  
  	if (mp->mnt_flag & MNT_UPDATE) {
  		nmp = VFSTONFS(mp);
***************
*** 691,696 ****
--- 692,698 ----
  	if (error)
  		goto bad;
  	*vpp = NFSTOV(np);
+ 	VOP_GETATTR(*vpp, &attrs, curproc->p_ucred, curproc);
  
  	/*
  	 * Lose the lock but keep the ref.
***************
*** 801,807 ****
  		return (error);
  	vp = NFSTOV(np);
  	VOP_UNLOCK(vp);
! 	vp->v_type = VDIR;
  	vp->v_flag = VROOT;
  	*vpp = vp;
  	return (0);
--- 803,809 ----
  		return (error);
  	vp = NFSTOV(np);
  	VOP_UNLOCK(vp);
! 	/* vp->v_type = VDIR; */
  	vp->v_flag = VROOT;
  	*vpp = vp;
  	return (0);
Index: kern/vfs_lookup.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/vfs_lookup.c,v
retrieving revision 1.7
diff -c -r1.7 vfs_lookup.c
*** 1.7	1995/05/30 08:06:33
--- vfs_lookup.c	1995/08/10 18:03:19
***************
*** 433,446 ****
  	}
  
  	dp = ndp->ni_vp;
- 	/*
- 	 * Check for symbolic link
- 	 */
- 	if ((dp->v_type == VLNK) &&
- 	    ((cnp->cn_flags & FOLLOW) || *ndp->ni_next == '/')) {
- 		cnp->cn_flags |= ISSYMLINK;
- 		return (0);
- 	}
  
  	/*
  	 * Check to see if the vnode has been mounted on;
--- 433,438 ----
***************
*** 458,463 ****
--- 450,464 ----
  			goto bad2;
  		vput(dp);
  		ndp->ni_vp = dp = tdp;
+ 	}
+ 
+ 	/*
+ 	 * Check for symbolic link
+ 	 */
+ 	if ((dp->v_type == VLNK) &&
+ 	    ((cnp->cn_flags & FOLLOW) || *ndp->ni_next == '/')) {
+ 		cnp->cn_flags |= ISSYMLINK;
+ 		return (0);
  	}
  
  nextname:

--
Doug Rabson, Microsoft RenderMorphics Ltd.	Mail:  dfr@render.com
						Phone: +44 171 251 4411
						FAX:   +44 171 251 0939




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.950810192533.4478X-100000>