From 05803be000f8e4a0a5e48a9ed9f857fcbf8e5134 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Tue, 5 Jan 2021 09:47:01 +0100 Subject: [PATCH] cache: stop setting cn_nameptr on entry as matches cn_pnbuf already While here tidy up other asserts. --- sys/kern/vfs_cache.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 1ad72630e1dc..7260896df452 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5165,18 +5165,19 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, struct nameidata_saved orig; int error; - MPASS(ndp->ni_lcf == 0); - fpl.status = CACHE_FPL_STATUS_UNSET; fpl.ndp = ndp; - fpl.cnp = &ndp->ni_cnd; - MPASS(curthread == fpl.cnp->cn_thread); - KASSERT ((fpl.cnp->cn_flags & CACHE_FPL_INTERNAL_CN_FLAGS) == 0, - ("%s: internal flags found in cn_flags %" PRIx64, __func__, - fpl.cnp->cn_flags)); + fpl.cnp = cnp = &ndp->ni_cnd; - if ((fpl.cnp->cn_flags & SAVESTART) != 0) - MPASS(fpl.cnp->cn_nameiop != LOOKUP); + MPASS(ndp->ni_lcf == 0); + MPASS(curthread == cnp->cn_thread); + KASSERT ((cnp->cn_flags & CACHE_FPL_INTERNAL_CN_FLAGS) == 0, + ("%s: internal flags found in cn_flags %" PRIx64, __func__, + cnp->cn_flags)); + if ((cnp->cn_flags & SAVESTART) != 0) { + MPASS(cnp->cn_nameiop != LOOKUP); + } + MPASS(cnp->cn_nameptr == cnp->cn_pnbuf); if (!cache_can_fplookup(&fpl)) { SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); @@ -5193,8 +5194,6 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, ndp->ni_rootdir = pwd->pwd_rdir; ndp->ni_topdir = pwd->pwd_jdir; - cnp = fpl.cnp; - cnp->cn_nameptr = cnp->cn_pnbuf; if (cnp->cn_pnbuf[0] == '/') { dvp = cache_fpl_handle_root(&fpl); ndp->ni_resflags |= NIRES_ABS;