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/1d766befefdb
branches:  trunk
changeset: 764070:1d766befefdb
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:15:38 2011 +0000

description:
description:
Improve previous by manipulating ni_dvp more intelligently.

diffstat:

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

diffs (66 lines):

diff -r 1f9f3e405bb1 -r 1d766befefdb sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:15:21 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:15:38 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.155 2011/04/11 02:15:21 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.156 2011/04/11 02:15:38 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.155 2011/04/11 02:15:21 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.156 2011/04/11 02:15:38 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -1078,6 +1078,8 @@
                cnp->cn_flags &= ~ISSYMLINK;
 
     dirloop:
+               KASSERT(ndp->ni_dvp == NULL);
+
                /*
                 * If we have a leading string of slashes, remove
                 * them, and just make sure the current node is a
@@ -1093,8 +1095,8 @@
 
                        if (searchdir->v_type != VDIR) {
                                vput(searchdir);
+                               KASSERT(ndp->ni_dvp == NULL);
                                ndp->ni_vp = NULL;
-                               KASSERT(ndp->ni_dvp == NULL);
                                state->attempt_retry = 1;
                                return ENOTDIR;
                        }
@@ -1116,17 +1118,17 @@
                error = lookup_parsepath(state);
                if (error) {
                        vput(searchdir);
-                       ndp->ni_dvp = NULL;
+                       KASSERT(ndp->ni_dvp == NULL);
                        ndp->ni_vp = NULL;
                        state->attempt_retry = 1;
                        return (error);
                }
 
                error = lookup_once(state, searchdir, &searchdir, &foundobj);
-               ndp->ni_dvp = searchdir;
                if (error) {
+                       vput(searchdir);
+                       KASSERT(ndp->ni_dvp == NULL);
                        ndp->ni_vp = NULL;
-                       vput(ndp->ni_dvp);
                        /*
                         * Note that if we're doing TRYEMULROOT we can
                         * retry with the normal root. Where this is
@@ -1139,6 +1141,7 @@
                        state->attempt_retry = 1;
                        return (error);
                }
+               ndp->ni_dvp = searchdir;
                ndp->ni_vp = foundobj;
                // XXX ought to be able to avoid this case too
                if (state->lookup_alldone) {



Home | Main Index | Thread Index | Old Index