Re: [PATCH 4/7 v2] tracing: Have trace events system open call tracing_open_generic_tr()

From: Steven Rostedt
Date: Fri Oct 11 2019 - 22:09:59 EST


On Fri, 11 Oct 2019 20:57:51 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -1391,9 +1391,6 @@ static int subsystem_open(struct inode *inode, struct file *filp)
> struct trace_array *tr;
> int ret;
>
> - if (tracing_is_disabled())
> - return -ENODEV;
> -
> /* Make sure the system still exists */
> mutex_lock(&event_mutex);
> mutex_lock(&trace_types_lock);
> @@ -1420,16 +1417,9 @@ static int subsystem_open(struct inode *inode, struct file *filp)
> WARN_ON(!dir);
>
> /* Still need to increment the ref count of the system */
> - if (trace_array_get(tr) < 0) {
> - put_system(dir);
> - return -ENODEV;
> - }
> -
> - ret = tracing_open_generic(inode, filp);
> - if (ret < 0) {
> - trace_array_put(tr);
> + ret = tracing_open_generic_tr(inode, filp);
> + if (ret < 0)
> put_system(dir);
> - }
>
> return ret;
> }

I got a bit too aggressive on this patch. The subsystem_open() gets the
tr from a search, not from the inode. Thus it can't use the
tracing_open_generic_tr() call. It needs to do the trace_array_get()
directly.

V2 of this patch:

-- Steve