Commit 0c62f6cd authored by Tom Zanussi's avatar Tom Zanussi Committed by Steven Rostedt (VMware)

tracing: Don't return -EINVAL when tracing soft disabled synth events

There's no reason to return -EINVAL when tracing a synthetic event if
it's soft disabled - treat it the same as if it were hard disabled and
return normally.

Have synth_event_trace() and synth_event_trace_array() just return
normally, and have synth_event_trace_start set the trace state to
disabled and return.

Link: http://lkml.kernel.org/r/df5d02a1625aff97c9866506c5bada6a069982ba.1581374549.git.zanussi@kernel.org

Fixes: 8dcc53ad ("tracing: Add synth_event_trace() and related functions")
Signed-off-by: default avatarTom Zanussi <zanussi@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent d090409a
...@@ -1828,7 +1828,8 @@ int synth_event_trace(struct trace_event_file *file, unsigned int n_vals, ...) ...@@ -1828,7 +1828,8 @@ int synth_event_trace(struct trace_event_file *file, unsigned int n_vals, ...)
* called directly by the user, we don't have that but we * called directly by the user, we don't have that but we
* still need to honor not logging when disabled. * still need to honor not logging when disabled.
*/ */
if (!(file->flags & EVENT_FILE_FL_ENABLED)) if (!(file->flags & EVENT_FILE_FL_ENABLED) ||
trace_trigger_soft_disabled(file))
return 0; return 0;
event = file->event_call->data; event = file->event_call->data;
...@@ -1836,9 +1837,6 @@ int synth_event_trace(struct trace_event_file *file, unsigned int n_vals, ...) ...@@ -1836,9 +1837,6 @@ int synth_event_trace(struct trace_event_file *file, unsigned int n_vals, ...)
if (n_vals != event->n_fields) if (n_vals != event->n_fields)
return -EINVAL; return -EINVAL;
if (trace_trigger_soft_disabled(file))
return -EINVAL;
fields_size = event->n_u64 * sizeof(u64); fields_size = event->n_u64 * sizeof(u64);
/* /*
...@@ -1918,7 +1916,8 @@ int synth_event_trace_array(struct trace_event_file *file, u64 *vals, ...@@ -1918,7 +1916,8 @@ int synth_event_trace_array(struct trace_event_file *file, u64 *vals,
* called directly by the user, we don't have that but we * called directly by the user, we don't have that but we
* still need to honor not logging when disabled. * still need to honor not logging when disabled.
*/ */
if (!(file->flags & EVENT_FILE_FL_ENABLED)) if (!(file->flags & EVENT_FILE_FL_ENABLED) ||
trace_trigger_soft_disabled(file))
return 0; return 0;
event = file->event_call->data; event = file->event_call->data;
...@@ -1926,9 +1925,6 @@ int synth_event_trace_array(struct trace_event_file *file, u64 *vals, ...@@ -1926,9 +1925,6 @@ int synth_event_trace_array(struct trace_event_file *file, u64 *vals,
if (n_vals != event->n_fields) if (n_vals != event->n_fields)
return -EINVAL; return -EINVAL;
if (trace_trigger_soft_disabled(file))
return -EINVAL;
fields_size = event->n_u64 * sizeof(u64); fields_size = event->n_u64 * sizeof(u64);
/* /*
...@@ -2017,7 +2013,8 @@ int synth_event_trace_start(struct trace_event_file *file, ...@@ -2017,7 +2013,8 @@ int synth_event_trace_start(struct trace_event_file *file,
* trace case, we save the enabed state upon start and just * trace case, we save the enabed state upon start and just
* ignore the following data calls. * ignore the following data calls.
*/ */
if (!(file->flags & EVENT_FILE_FL_ENABLED)) { if (!(file->flags & EVENT_FILE_FL_ENABLED) ||
trace_trigger_soft_disabled(file)) {
trace_state->enabled = false; trace_state->enabled = false;
goto out; goto out;
} }
...@@ -2026,11 +2023,6 @@ int synth_event_trace_start(struct trace_event_file *file, ...@@ -2026,11 +2023,6 @@ int synth_event_trace_start(struct trace_event_file *file,
trace_state->event = file->event_call->data; trace_state->event = file->event_call->data;
if (trace_trigger_soft_disabled(file)) {
ret = -EINVAL;
goto out;
}
fields_size = trace_state->event->n_u64 * sizeof(u64); fields_size = trace_state->event->n_u64 * sizeof(u64);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment