lkml.org 
[lkml]   [2013]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: PATCH? trace_remove_event_call() should fail if call is active
On 07/02, Oleg Nesterov wrote:
>
> So please ignore modules ;)

Or lets discuss the change above.

Oleg.

--- x/kernel/trace/trace_events.c
+++ x/kernel/trace/trace_events.c
@@ -1611,14 +1611,40 @@ static void __trace_remove_event_call(st
destroy_preds(call);
}

+static int event_can_remove(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;
+ if (file->flags & FTRACE_EVENT_FL_ENABLED)
+ return -EBUSY;
+ break;
+ } while_for_each_event_file();
+
+ 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 err;
+
mutex_lock(&event_mutex);
down_write(&trace_event_sem);
- __trace_remove_event_call(call);
+ err = event_can_remove(call);
+ if (!err)
+ __trace_remove_event_call(call);
up_write(&trace_event_sem);
mutex_unlock(&event_mutex);
+
+ return err;
}

#define for_each_event(event, start, end) \


\
 
 \ /
  Last update: 2013-07-03 01:01    [W:0.085 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site