kernel-ark/kernel/trace
Xiao Guangrong 04aef32d39 tracing/function: Fix the return value of ftrace_trace_onoff_callback()
ftrace_trace_onoff_callback() will return an error even if we do the
right operation, for example:

 # echo _spin_*:traceon:10 > set_ftrace_filter
 -bash: echo: write error: Invalid argument
 # cat set_ftrace_filter
 #### all functions enabled ####
 _spin_trylock_bh:traceon:count=10
 _spin_unlock_irq:traceon:count=10
 _spin_unlock_bh:traceon:count=10
 _spin_lock_irq:traceon:count=10
 _spin_unlock:traceon:count=10
 _spin_trylock:traceon:count=10
 _spin_unlock_irqrestore:traceon:count=10
 _spin_lock_irqsave:traceon:count=10
 _spin_lock_bh:traceon:count=10
 _spin_lock:traceon:count=10

We want to set _spin_*:traceon:10 to set_ftrace_filter, it complains
with "Invalid argument", but the operation is successful.

This is because ftrace_process_regex() returns the number of functions that
matched the pattern. If the number is not 0, this value is returned
by ftrace_regex_write() whereas we want to return the number of bytes
virtually written.
Also the file offset pointer is not updated in this case.

If the number of matched functions is lower than the number of bytes written
by the user, this results to a reprocessing of the string given by the user with
a lower size, leading to a malformed ftrace regex and then a -EINVAL returned.

So, this patch fixes it by returning 0 if no error occured.
The fix also applies on 2.6.30

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: stable@kernel.org
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
2009-07-16 23:34:32 -04:00
..
blktrace.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
ftrace.c tracing/function-profiler: do not free per cpu variable stat 2009-07-13 11:01:10 +02:00
Kconfig tracing/fastboot: Document the need of initcall_debug 2009-06-29 10:22:10 +02:00
kmemtrace.c cpumask: use new operators in kernel/trace 2009-06-15 11:36:42 -04:00
Makefile tracing/events: convert block trace points to TRACE_EVENT() 2009-06-09 12:34:23 -04:00
ring_buffer_benchmark.c ring-buffer: have benchmark test print to trace buffer 2009-06-17 17:01:09 -04:00
ring_buffer.c ring-buffer: Make it generally available 2009-06-25 10:31:30 +02:00
trace_boot.c
trace_branch.c
trace_clock.c
trace_event_profile.c
trace_event_types.h trace_export: Repair missed fields 2009-06-26 20:48:40 +02:00
trace_events_filter.c tracing/filters: fix race between filter setting and module unload 2009-06-16 16:25:37 -04:00
trace_events.c tracing/events: Don't increment @pos in s_start() 2009-06-24 11:02:49 +02:00
trace_export.c
trace_functions_graph.c function-graph: add stack frame test 2009-06-18 18:40:18 -04:00
trace_functions.c tracing/function: Fix the return value of ftrace_trace_onoff_callback() 2009-07-16 23:34:32 -04:00
trace_hw_branches.c
trace_irqsoff.c
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Fix trace_print_seq() 2009-07-02 08:51:13 +02:00
trace_output.h tracing: add protection around module events unload 2009-06-09 17:29:07 -04:00
trace_power.c
trace_printk.c tracing_bprintk: Don't increment @pos in t_start() 2009-06-24 11:02:50 +02:00
trace_sched_switch.c
trace_sched_wakeup.c
trace_selftest_dynamic.c
trace_selftest.c
trace_stack.c tracing: Fix stack tracer sysctl handling 2009-06-26 20:48:39 +02:00
trace_stat.c trace_stat: Don't increment @pos in seq start() 2009-06-24 11:02:51 +02:00
trace_stat.h
trace_syscalls.c
trace_sysprof.c Merge branch 'timers-for-linus-migration' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-06-15 10:06:19 -07:00
trace_workqueue.c trace_workqueue: remove blank line between each cpu 2009-06-02 01:14:26 +02:00
trace.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
trace.h ring-buffer: Make it generally available 2009-06-25 10:31:30 +02:00