Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern description:



details:   https://anonhg.NetBSD.org/src/rev/17cdf8bb0015
branches:  trunk
changeset: 764079:17cdf8bb0015
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:18:07 2011 +0000

description:
description:
Don't assign ni_vp until namei_oneroot() returns.

diffstat:

 sys/kern/vfs_lookup.c |  16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diffs (76 lines):

diff -r d91af51eb44f -r 17cdf8bb0015 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:17:54 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:18:07 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.164 2011/04/11 02:17:54 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.165 2011/04/11 02:18:07 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.164 2011/04/11 02:17:54 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.165 2011/04/11 02:18:07 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -1103,7 +1103,6 @@
                if (cnp->cn_nameptr[0] == '\0') {
                        vref(searchdir);
                        foundobj = searchdir;
-                       ndp->ni_vp = foundobj;
                        cnp->cn_flags |= ISLASTCN;
 
                        /* bleh */
@@ -1137,7 +1136,6 @@
                        return (error);
                }
                KASSERT(ndp->ni_dvp == NULL);
-               ndp->ni_vp = foundobj;
 
                if (foundobj == NULL) {
                        /*
@@ -1171,13 +1169,13 @@
                                 * symlink in. (FUTURE)
                                 */
                                error = namei_follow(state, inhibitmagic,
-                                                    searchdir, ndp->ni_vp,
+                                                    searchdir, foundobj,
                                                     &searchdir);
                        }
                        if (error) {
-                               KASSERT(searchdir != ndp->ni_vp);
+                               KASSERT(searchdir != foundobj);
                                vput(searchdir);
-                               vput(ndp->ni_vp);
+                               vput(foundobj);
                                KASSERT(ndp->ni_dvp == NULL);
                                ndp->ni_vp = NULL;
                                return error;
@@ -1240,7 +1238,6 @@
                        foundobj = ndp->ni_rootdir;
                        vref(foundobj);
                        vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY);
-                       ndp->ni_vp = foundobj;
                }
 
                /*
@@ -1307,7 +1304,7 @@
         * If LOCKPARENT is not set, the parent directory isn't returned.
         */
        if ((cnp->cn_flags & LOCKPARENT) == 0 && searchdir != NULL) {
-               if (searchdir == ndp->ni_vp) {
+               if (searchdir == foundobj) {
                        vrele(searchdir);
                } else {
                        vput(searchdir);
@@ -1316,6 +1313,7 @@
        }
 
        ndp->ni_dvp = searchdir;
+       ndp->ni_vp = foundobj;
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index