git: c9536389d732 - main - vfs: hoist cn_thread assert in namei

Mateusz Guzik mjg at FreeBSD.org
Fri Oct 1 21:56:34 UTC 2021


The branch main has been updated by mjg:

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

commit c9536389d732feecf61afa4632397d67b04b2ab4
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-10-01 21:13:38 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-10-01 21:56:29 +0000

    vfs: hoist cn_thread assert in namei
    
    Making it condtional on whether ktrace happens to be enabled makes no
    sense.
---
 sys/kern/vfs_lookup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 28d7ada0f434..e262ebde6ae2 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -554,6 +554,8 @@ namei(struct nameidata *ndp)
 	cnp = &ndp->ni_cnd;
 	td = cnp->cn_thread;
 #ifdef INVARIANTS
+	KASSERT(cnp->cn_thread == curthread,
+	    ("namei not using curthread"));
 	KASSERT((ndp->ni_debugflags & NAMEI_DBG_CALLED) == 0,
 	    ("%s: repeated call to namei without NDREINIT", __func__));
 	KASSERT(ndp->ni_debugflags == NAMEI_DBG_INITED,
@@ -608,8 +610,6 @@ namei(struct nameidata *ndp)
 
 #ifdef KTRACE
 	if (KTRPOINT(td, KTR_NAMEI)) {
-		KASSERT(cnp->cn_thread == curthread,
-		    ("namei not using curthread"));
 		ktrnamei(cnp->cn_pnbuf);
 	}
 #endif


More information about the dev-commits-src-all mailing list