git: 623daa69f9f4 - main - cache: assert internal flags are not passed by namei

Mateusz Guzik mjg at FreeBSD.org
Sun Dec 27 21:05:01 UTC 2020


The branch main has been updated by mjg:

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

commit 623daa69f9f43613f49ea6164175195ea3a8b3e9
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2020-12-27 19:42:16 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2020-12-27 19:49:24 +0000

    cache: assert internal flags are not passed by namei
---
 sys/kern/vfs_cache.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 38121893126e..6e5154df63a1 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -67,6 +67,9 @@ __FBSDID("$FreeBSD$");
 #ifdef KTRACE
 #include <sys/ktrace.h>
 #endif
+#ifdef INVARIANTS
+#include <machine/_inttypes.h>
+#endif
 
 #include <sys/capsicum.h>
 
@@ -4704,6 +4707,9 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status,
 	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));
 
 	if ((fpl.cnp->cn_flags & SAVESTART) != 0)
 		MPASS(fpl.cnp->cn_nameiop != LOOKUP);


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