Commit 9ff4b974 authored by Pekka Paalanen's avatar Pekka Paalanen Committed by Ingo Molnar

tracing/ftrace: fix pipe breaking

This patch fixes a bug which break the pipe when the seq is empty.
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 2c4f035f
...@@ -2439,7 +2439,6 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, ...@@ -2439,7 +2439,6 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
sret = trace_seq_to_user(&iter->seq, ubuf, cnt); sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
if (sret != -EBUSY) if (sret != -EBUSY)
return sret; return sret;
sret = 0;
trace_seq_reset(&iter->seq); trace_seq_reset(&iter->seq);
...@@ -2450,6 +2449,8 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, ...@@ -2450,6 +2449,8 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
goto out; goto out;
} }
waitagain:
sret = 0;
while (trace_empty(iter)) { while (trace_empty(iter)) {
if ((filp->f_flags & O_NONBLOCK)) { if ((filp->f_flags & O_NONBLOCK)) {
...@@ -2556,8 +2557,13 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, ...@@ -2556,8 +2557,13 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
sret = trace_seq_to_user(&iter->seq, ubuf, cnt); sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
if (iter->seq.readpos >= iter->seq.len) if (iter->seq.readpos >= iter->seq.len)
trace_seq_reset(&iter->seq); 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) if (sret == -EBUSY)
sret = 0; goto waitagain;
out: out:
mutex_unlock(&trace_types_lock); mutex_unlock(&trace_types_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment