mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
ftrace: Use guard for match_records()
The ftrace_lock is held for most of match_records() until the end of the function. Use guard to make error paths simpler. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/20241028071307.927146604@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
6348a3fa72
commit
06294cf045
@ -4829,15 +4829,13 @@ match_records(struct ftrace_hash *hash, char *func, int len, char *mod)
|
||||
mod_g.len = strlen(mod_g.search);
|
||||
}
|
||||
|
||||
mutex_lock(&ftrace_lock);
|
||||
guard(mutex)(&ftrace_lock);
|
||||
|
||||
if (unlikely(ftrace_disabled))
|
||||
goto out_unlock;
|
||||
return 0;
|
||||
|
||||
if (func_g.type == MATCH_INDEX) {
|
||||
found = add_rec_by_index(hash, &func_g, clear_filter);
|
||||
goto out_unlock;
|
||||
}
|
||||
if (func_g.type == MATCH_INDEX)
|
||||
return add_rec_by_index(hash, &func_g, clear_filter);
|
||||
|
||||
do_for_each_ftrace_rec(pg, rec) {
|
||||
|
||||
@ -4846,16 +4844,12 @@ match_records(struct ftrace_hash *hash, char *func, int len, char *mod)
|
||||
|
||||
if (ftrace_match_record(rec, &func_g, mod_match, exclude_mod)) {
|
||||
ret = enter_record(hash, rec, clear_filter);
|
||||
if (ret < 0) {
|
||||
found = ret;
|
||||
goto out_unlock;
|
||||
}
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
found = 1;
|
||||
}
|
||||
cond_resched();
|
||||
} while_for_each_ftrace_rec();
|
||||
out_unlock:
|
||||
mutex_unlock(&ftrace_lock);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user