lkml.org 
[lkml]   [2013]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 1/1] tracing: trace_remove_event_call() should fail if call/file is in use
From
Date
On Mon, 2013-07-29 at 19:50 +0200, Oleg Nesterov wrote:
>
> +static int probe_remove_event_call(struct ftrace_event_call *call)
> +{
> + struct trace_array *tr;
> + struct ftrace_event_file *file;
> +
> +#ifdef CONFIG_PERF_EVENTS
> + if (call->perf_refcount)
> + return -EBUSY;
> +#endif
> + do_for_each_event_file(tr, file) {
> + if (file->event_call != call)
> + continue;
> + /*
> + * We can't rely on ftrace_event_enable_disable(enable => 0)
> + * we are going to do, FTRACE_EVENT_FL_SOFT_MODE can suppress
> + * TRACE_REG_UNREGISTER.
> + */
> + if (file->flags & FTRACE_EVENT_FL_ENABLED)
> + return -EBUSY;
> + break;

I'm going to modify the patch to include a comment here about the break
being used to go to the next trace_array and not leaving the loop.

-- Steve

> + } while_for_each_event_file();
> +
> + __trace_remove_event_call(call);
> +
> + return 0;
> +}
> +
> /* Remove an event_call */
> -void trace_remove_event_call(struct ftrace_event_call *call)
> +int trace_remove_event_call(struct ftrace_event_call *call)
> {
> + int ret;
> +
> mutex_lock(&trace_types_lock);
> mutex_lock(&event_mutex);
> down_write(&trace_event_sem);
> - __trace_remove_event_call(call);
> + ret = probe_remove_event_call(call);
> up_write(&trace_event_sem);
> mutex_unlock(&event_mutex);
> mutex_unlock(&trace_types_lock);
> +
> + return ret;
> }
>
> #define for_each_event(event, start, end) \




\
 
 \ /
  Last update: 2013-07-31 19:21    [W:0.194 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site