Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jan 2021 07:36:11 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 05803be000f8 - main - cache: stop setting cn_nameptr on entry as matches cn_pnbuf already
Message-ID:  <202101060736.1067aBOA077445@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=05803be000f8e4a0a5e48a9ed9f857fcbf8e5134

commit 05803be000f8e4a0a5e48a9ed9f857fcbf8e5134
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-01-05 08:47:01 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-01-06 06:03:41 +0000

    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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101060736.1067aBOA077445>