Module Name:    src
Committed By:   dholland
Date:           Mon Apr 11 02:17:14 UTC 2011

Modified Files:
        src/sys/kern: vfs_lookup.c

Log Message:
description:
Pass foundobj to namei_follow() instead of fishing in the global state.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/kern/vfs_lookup.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.160 src/sys/kern/vfs_lookup.c:1.161
--- src/sys/kern/vfs_lookup.c:1.160	Mon Apr 11 02:17:01 2011
+++ src/sys/kern/vfs_lookup.c	Mon Apr 11 02:17:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.160 2011/04/11 02:17:01 dholland Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.161 2011/04/11 02:17:14 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.160 2011/04/11 02:17:01 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.161 2011/04/11 02:17:14 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -633,7 +633,7 @@
  */
 static inline int
 namei_follow(struct namei_state *state, int inhibitmagic,
-	     struct vnode *searchdir,
+	     struct vnode *searchdir, struct vnode *foundobj,
 	     struct vnode **newsearchdir_ret)
 {
 	struct nameidata *ndp = state->ndp;
@@ -649,8 +649,8 @@
 	if (ndp->ni_loopcnt++ >= MAXSYMLINKS) {
 		return ELOOP;
 	}
-	if (ndp->ni_vp->v_mount->mnt_flag & MNT_SYMPERM) {
-		error = VOP_ACCESS(ndp->ni_vp, VEXEC, cnp->cn_cred);
+	if (foundobj->v_mount->mnt_flag & MNT_SYMPERM) {
+		error = VOP_ACCESS(foundobj, VEXEC, cnp->cn_cred);
 		if (error != 0)
 			return error;
 	}
@@ -665,7 +665,7 @@
 	auio.uio_rw = UIO_READ;
 	auio.uio_resid = MAXPATHLEN;
 	UIO_SETUP_SYSSPACE(&auio);
-	error = VOP_READLINK(ndp->ni_vp, &auio, cnp->cn_cred);
+	error = VOP_READLINK(foundobj, &auio, cnp->cn_cred);
 	if (error) {
 		PNBUF_PUT(cp);
 		return error;
@@ -698,7 +698,7 @@
 	ndp->ni_pathlen += linklen;
 	memcpy(ndp->ni_pnbuf, cp, ndp->ni_pathlen);
 	PNBUF_PUT(cp);
-	vput(ndp->ni_vp);
+	vput(foundobj);
 
 	/*
 	 * Check if root directory should replace current directory.
@@ -1173,7 +1173,7 @@
 				 * symlink in. (FUTURE)
 				 */
 				error = namei_follow(state, inhibitmagic,
-						     searchdir,
+						     searchdir, ndp->ni_vp,
 						     &searchdir);
 			}
 			if (error) {

Reply via email to