From: Frederic Weisbecker <fweisbec@gmail.com>
To: mingo@elte.hu
Cc: linux-kernel@vger.kernel.org, pq@iki.fi, rostedt@goodmis.org
Subject: [PATCH -tip 2/4] Tracing/ftrace: Fix pipe breaking
Date: Mon, 29 Sep 2008 20:23:48 +0200 [thread overview]
Message-ID: <48E11D34.4000702@gmail.com> (raw)
From: Pekka Paalanen <pq@iki.fi>
This patch fixes a bug which break the pipe when the seq is empty.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
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 61f33da..ed10a68 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2610,7 +2610,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);
@@ -2621,6 +2620,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)) {
@@ -2754,8 +2755,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);
reply other threads:[~2008-09-29 18:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48E11D34.4000702@gmail.com \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=pq@iki.fi \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox