lkml.org 
[lkml]   [2009]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH tracing/kprobes 3/3] tracing/ftrace: Fix to check create_event_dir() when adding new events
Date
Check result of create_event_dir() and add ftrace_event_call to
ftrace_events list only if it is succeeded. Thanks Li for pointing it out.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jason Baron <jbaron@redhat.com>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
---
kernel/trace/trace_events.c | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a4b7c9a..f03cda3 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -957,12 +957,14 @@ static int __trace_add_event_call(struct ftrace_event_call *call)
if (!d_events)
return -ENOENT;

- list_add(&call->list, &ftrace_events);
ret = event_create_dir(call, d_events, &ftrace_event_id_fops,
&ftrace_enable_fops, &ftrace_event_filter_fops,
&ftrace_event_format_fops);
if (ret < 0)
- list_del(&call->list);
+ pr_warning("Could not create directory of trace events/%s\n",
+ call->name);
+ else
+ list_add(&call->list, &ftrace_events);
return ret;
}

@@ -1124,10 +1126,15 @@ static void trace_module_add_events(struct module *mod)
return;
}
call->mod = mod;
+ ret = event_create_dir(call, d_events,
+ &file_ops->id, &file_ops->enable,
+ &file_ops->filter, &file_ops->format);
+ if (ret < 0) {
+ pr_warning("Could not create directory of trace "
+ "point events/%s\n", call->name);
+ continue;
+ }
list_add(&call->list, &ftrace_events);
- event_create_dir(call, d_events,
- &file_ops->id, &file_ops->enable,
- &file_ops->filter, &file_ops->format);
}
}

@@ -1267,10 +1274,16 @@ static __init int event_trace_init(void)
continue;
}
}
+ ret = event_create_dir(call, d_events, &ftrace_event_id_fops,
+ &ftrace_enable_fops,
+ &ftrace_event_filter_fops,
+ &ftrace_event_format_fops);
+ if (ret < 0) {
+ pr_warning("Could not create directory of trace "
+ "point events/%s\n", call->name);
+ continue;
+ }
list_add(&call->list, &ftrace_events);
- event_create_dir(call, d_events, &ftrace_event_id_fops,
- &ftrace_enable_fops, &ftrace_event_filter_fops,
- &ftrace_event_format_fops);
}

while (true) {

--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


\
 
 \ /
  Last update: 2009-09-25 20:23    [from the cache]
©2003-2011 Jasper Spaans