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/c3c7cde02b96
branches:  trunk
changeset: 764064:c3c7cde02b96
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:12:58 2011 +0000

description:
description:
As ndp->ni_dvp is also assigned to the updated search dir on every
return from lookup_once(), pass it back instead and update ni_dvp in
the caller.

diffstat:

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

diffs (86 lines):

diff -r a2f4b1492782 -r c3c7cde02b96 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:12:42 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:12:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.149 2011/04/11 02:12:42 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.150 2011/04/11 02:12:58 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.149 2011/04/11 02:12:42 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.150 2011/04/11 02:12:58 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -857,6 +857,7 @@
 static int
 lookup_once(struct namei_state *state,
            struct vnode *searchdir,
+           struct vnode **newsearchdir_ret,
            struct vnode **foundobj_ret)
 {
        struct vnode *foundobj;
@@ -891,7 +892,7 @@
                        if (searchdir == ndp->ni_rootdir || searchdir == rootvnode) {
                                foundobj = searchdir;
                                vref(foundobj);
-                               ndp->ni_dvp = searchdir;
+                               *newsearchdir_ret = searchdir;
                                *foundobj_ret = foundobj;
                                return 0;
                        }
@@ -914,8 +915,8 @@
                                    foundobj = ndp->ni_rootdir;
                                    vref(foundobj);
                                    vref(foundobj);
-                                   ndp->ni_dvp = foundobj;
                                    vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY);
+                                   *newsearchdir_ret = foundobj;
                                    *foundobj_ret = foundobj;
                                    return 0;
                                }
@@ -980,10 +981,10 @@
                /*
                 * We return with foundobj NULL to indicate that the entry
                 * doesn't currently exist, leaving a pointer to the
-                * (possibly locked) directory vnode in ndp->ni_dvp.
+                * (possibly locked) directory vnode as searchdir.
                 */
                state->lookup_alldone = 1;
-               ndp->ni_dvp = searchdir;
+               *newsearchdir_ret = searchdir;
                *foundobj_ret = NULL;
                return (0);
        }
@@ -1035,7 +1036,7 @@
                vn_lock(foundobj, LK_EXCLUSIVE | LK_RETRY);
        }
 
-       ndp->ni_dvp = searchdir;
+       *newsearchdir_ret = searchdir;
        *foundobj_ret = foundobj;
        return 0;
 }
@@ -1143,7 +1144,8 @@
                        return (error);
                }
 
-               error = lookup_once(state, searchdir, &foundobj);
+               error = lookup_once(state, searchdir, &searchdir, &foundobj);
+               ndp->ni_dvp = searchdir;
                if (error) {
                        ndp->ni_vp = NULL;
                        /* XXX this should use namei_end() */
@@ -1452,7 +1454,7 @@
        else
                cnp->cn_flags &= ~ISDOTDOT;
 
-       error = lookup_once(state, startdir, &foundobj);
+       error = lookup_once(state, startdir, &ndp->ni_dvp, &foundobj);
        if (error) {
                goto bad;
        }



Home | Main Index | Thread Index | Old Index