diff options
author | Pekka Paalanen <pq@iki.fi> | 2008-09-29 14:23:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-14 04:39:01 -0400 |
commit | 9ff4b9744c187cae58c3774361ea090addbc4130 (patch) | |
tree | f001a85312b374fbd91d332eb341d02522512da1 | |
parent | 2c4f035f6c3e8fda661eb6105aa51ef07aa71607 (diff) |
tracing/ftrace: fix pipe breaking
This patch fixes a bug which break the pipe when the seq is empty.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/trace/trace.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index b38a4bb40548..6a1c76bb56ba 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -2439,7 +2439,6 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, | |||
2439 | sret = trace_seq_to_user(&iter->seq, ubuf, cnt); | 2439 | sret = trace_seq_to_user(&iter->seq, ubuf, cnt); |
2440 | if (sret != -EBUSY) | 2440 | if (sret != -EBUSY) |
2441 | return sret; | 2441 | return sret; |
2442 | sret = 0; | ||
2443 | 2442 | ||
2444 | trace_seq_reset(&iter->seq); | 2443 | trace_seq_reset(&iter->seq); |
2445 | 2444 | ||
@@ -2450,6 +2449,8 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, | |||
2450 | goto out; | 2449 | goto out; |
2451 | } | 2450 | } |
2452 | 2451 | ||
2452 | waitagain: | ||
2453 | sret = 0; | ||
2453 | while (trace_empty(iter)) { | 2454 | while (trace_empty(iter)) { |
2454 | 2455 | ||
2455 | if ((filp->f_flags & O_NONBLOCK)) { | 2456 | if ((filp->f_flags & O_NONBLOCK)) { |
@@ -2556,8 +2557,13 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, | |||
2556 | sret = trace_seq_to_user(&iter->seq, ubuf, cnt); | 2557 | sret = trace_seq_to_user(&iter->seq, ubuf, cnt); |
2557 | if (iter->seq.readpos >= iter->seq.len) | 2558 | if (iter->seq.readpos >= iter->seq.len) |
2558 | trace_seq_reset(&iter->seq); | 2559 | trace_seq_reset(&iter->seq); |
2560 | |||
2561 | /* | ||
2562 | * If there was nothing to send to user, inspite of consuming trace | ||
2563 | * entries, go back to wait for more entries. | ||
2564 | */ | ||
2559 | if (sret == -EBUSY) | 2565 | if (sret == -EBUSY) |
2560 | sret = 0; | 2566 | goto waitagain; |
2561 | 2567 | ||
2562 | out: | 2568 | out: |
2563 | mutex_unlock(&trace_types_lock); | 2569 | mutex_unlock(&trace_types_lock); |