diff options
author | Pekka Paalanen <pq@iki.fi> | 2008-09-29 20:23:48 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-14 10:39:01 +0200 |
commit | 9ff4b9744c187cae58c3774361ea090addbc4130 (patch) | |
tree | f001a85312b374fbd91d332eb341d02522512da1 | |
parent | 2c4f035f6c3e8fda661eb6105aa51ef07aa71607 (diff) | |
download | op-kernel-dev-9ff4b9744c187cae58c3774361ea090addbc4130.zip op-kernel-dev-9ff4b9744c187cae58c3774361ea090addbc4130.tar.gz |
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 b38a4bb..6a1c76b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2439,7 +2439,6 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, sret = trace_seq_to_user(&iter->seq, ubuf, cnt); if (sret != -EBUSY) return sret; - sret = 0; trace_seq_reset(&iter->seq); @@ -2450,6 +2449,8 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, goto out; } +waitagain: + sret = 0; while (trace_empty(iter)) { if ((filp->f_flags & O_NONBLOCK)) { @@ -2556,8 +2557,13 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, sret = trace_seq_to_user(&iter->seq, ubuf, cnt); if (iter->seq.readpos >= iter->seq.len) trace_seq_reset(&iter->seq); + + /* + * If there was nothing to send to user, inspite of consuming trace + * entries, go back to wait for more entries. + */ if (sret == -EBUSY) - sret = 0; + goto waitagain; out: mutex_unlock(&trace_types_lock); |