Module Name: src Committed By: dholland Date: Mon Apr 11 02:15:38 UTC 2011
Modified Files: src/sys/kern: vfs_lookup.c Log Message: description: Improve previous by manipulating ni_dvp more intelligently. To generate a diff of this commit: cvs rdiff -u -r1.155 -r1.156 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.155 src/sys/kern/vfs_lookup.c:1.156 --- src/sys/kern/vfs_lookup.c:1.155 Mon Apr 11 02:15:21 2011 +++ src/sys/kern/vfs_lookup.c Mon Apr 11 02:15:38 2011 @@ -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); - ndp->ni_vp = NULL; KASSERT(ndp->ni_dvp == NULL); + ndp->ni_vp = 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) {