Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151339975
D41207.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D41207.diff
View Options
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2610,6 +2610,7 @@
options DEBUG_VFS_LOCKS # enable VFS lock debugging
options SOCKBUF_DEBUG # enable sockbuf last record/mb tail checking
options IFMEDIA_DEBUG # enable debugging in net/if_media.c
+options NAMEI_DEBUG # enable namei debugging
#
# Verbose SYSINIT
diff --git a/sys/conf/options b/sys/conf/options
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -1033,3 +1033,6 @@
# This option is insecure except in controlled environments where the static
# environment's contents are known to be safe.
PRESERVE_EARLY_KENV opt_global.h
+
+# Debug namei operations
+NAMEI_DEBUG opt_global.h
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -71,9 +71,6 @@
#include <vm/uma.h>
-#define NAMEI_DIAGNOSTIC 1
-#undef NAMEI_DIAGNOSTIC
-
#ifdef INVARIANTS
static void NDVALIDATE_impl(struct nameidata *, int);
#define NDVALIDATE(ndp) NDVALIDATE_impl(ndp, __LINE__)
@@ -187,6 +184,11 @@
&lookup_cap_dotdot_nonlocal, 0,
"enables \"..\" components in path lookup in capability mode "
"on non-local mount");
+#ifdef NAMEI_DEBUG
+static int namei_debug = NAMEI_DEBUG;
+SYSCTL_INT(_vfs, OID_AUTO, namei_debug, CTLFLAG_RWTUN, &namei_debug,
+ 0, "enables debugging messages for namei operations");
+#endif
static void
nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp)
@@ -1106,11 +1108,14 @@
error = ENAMETOOLONG;
goto bad;
}
-#ifdef NAMEI_DIAGNOSTIC
- { char c = *cp;
- *cp = '\0';
- printf("{%s}: ", cnp->cn_nameptr);
- *cp = c; }
+#ifdef NAMEI_DEBUG
+ if (namei_debug) {
+ char c = *cp;
+
+ *cp = '\0';
+ printf("{%s}: ", cnp->cn_nameptr);
+ *cp = c;
+ }
#endif
prev_ni_pathlen = ndp->ni_pathlen;
ndp->ni_pathlen -= cnp->cn_namelen;
@@ -1258,8 +1263,9 @@
*/
if (needs_exclusive_leaf(dp->v_mount, cnp->cn_flags))
cnp->cn_lkflags = LK_EXCLUSIVE;
-#ifdef NAMEI_DIAGNOSTIC
- vn_printf(dp, "lookup in ");
+#ifdef NAMEI_DEBUG
+ if (namei_debug)
+ vn_printf(dp, "lookup in ");
#endif
lkflags_save = cnp->cn_lkflags;
cnp->cn_lkflags = enforce_lkflags(dp->v_mount, cnp->cn_lkflags);
@@ -1267,8 +1273,9 @@
cnp->cn_lkflags = lkflags_save;
if (error != 0) {
KASSERT(ndp->ni_vp == NULL, ("leaf should be empty"));
-#ifdef NAMEI_DIAGNOSTIC
- printf("not found\n");
+#ifdef NAMEI_DEBUG
+ if (namei_debug)
+ printf("not found\n");
#endif
if ((error == ENOENT) &&
(dp->v_vflag & VV_ROOT) && (dp->v_mount != NULL) &&
@@ -1321,8 +1328,9 @@
}
good:
-#ifdef NAMEI_DIAGNOSTIC
- printf("found\n");
+#ifdef NAMEI_DEBUG
+ if (namei_debug)
+ printf("found\n");
#endif
dp = ndp->ni_vp;
@@ -1510,8 +1518,9 @@
*
* See a comment in vfs_lookup for cnp->cn_nameptr.
*/
-#ifdef NAMEI_DIAGNOSTIC
- printf("{%s}: ", cnp->cn_nameptr);
+#ifdef NAMEI_DEBUG
+ if (namei_debug)
+ printf("{%s}: ", cnp->cn_nameptr);
#endif
/*
@@ -1541,8 +1550,9 @@
/*
* We now have a segment name to search for, and a directory to search.
*/
-#ifdef NAMEI_DIAGNOSTIC
- vn_printf(dp, "search in ");
+#ifdef NAMEI_DEBUG
+ if (namei_debug)
+ vn_printf(dp, "search in ");
#endif
if ((error = VOP_LOOKUP(dp, vpp, cnp)) != 0) {
KASSERT(*vpp == NULL, ("leaf should be empty"));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 5:27 PM (11 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31109608
Default Alt Text
D41207.diff (3 KB)
Attached To
Mode
D41207: namei: Allow for runtime debug messages in name lookup
Attached
Detach File
Event Timeline
Log In to Comment