Skip to content

Commit 0ce0638

Browse files
Zheng Yejianrostedt
Zheng Yejian
authored andcommitted
ftrace: Properly unset FTRACE_HASH_FL_MOD
When executing following commands like what document said, but the log "#### all functions enabled ####" was not shown as expect: 1. Set a 'mod' filter: $ echo 'write*:mod:ext3' > /sys/kernel/tracing/set_ftrace_filter 2. Invert above filter: $ echo '!write*:mod:ext3' >> /sys/kernel/tracing/set_ftrace_filter 3. Read the file: $ cat /sys/kernel/tracing/set_ftrace_filter By some debugging, I found that flag FTRACE_HASH_FL_MOD was not unset after inversion like above step 2 and then result of ftrace_hash_empty() is incorrect. Link: https://lkml.kernel.org/r/[email protected] Cc: <[email protected]> Cc: [email protected] Fixes: 8c08f0d ("ftrace: Have cached module filters be an active filter") Signed-off-by: Zheng Yejian <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent dc399ad commit 0ce0638

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/trace/ftrace.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6081,8 +6081,12 @@ int ftrace_regex_release(struct inode *inode, struct file *file)
60816081

60826082
if (filter_hash) {
60836083
orig_hash = &iter->ops->func_hash->filter_hash;
6084-
if (iter->tr && !list_empty(&iter->tr->mod_trace))
6085-
iter->hash->flags |= FTRACE_HASH_FL_MOD;
6084+
if (iter->tr) {
6085+
if (list_empty(&iter->tr->mod_trace))
6086+
iter->hash->flags &= ~FTRACE_HASH_FL_MOD;
6087+
else
6088+
iter->hash->flags |= FTRACE_HASH_FL_MOD;
6089+
}
60866090
} else
60876091
orig_hash = &iter->ops->func_hash->notrace_hash;
60886092

0 commit comments

Comments
 (0)