Module Name: src Committed By: dholland Date: Mon Apr 11 02:12:58 UTC 2011
Modified Files: src/sys/kern: vfs_lookup.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.149 -r1.150 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.149 src/sys/kern/vfs_lookup.c:1.150 --- src/sys/kern/vfs_lookup.c:1.149 Mon Apr 11 02:12:42 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:12:58 2011 @@ -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; }