From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 3/4] tracing: Break out of tracing_wait_pipe() before wait_pipe() is called
Date: Wed, 30 Apr 2014 08:41:56 -0400 [thread overview]
Message-ID: <20140430124231.304968038@goodmis.org> (raw)
In-Reply-To: <20140430124153.334527053@goodmis.org>
[-- Attachment #1: 0003-tracing-Break-out-of-tracing_wait_pipe-before-wait_p.patch --]
[-- Type: text/plain, Size: 1445 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
When reading from trace_pipe, if tracing is off but nothing was read
it should block. If something is read and tracing is off, then EOF
is returned. If tracing is on and there's nothing to read, it will block.
But because the check of whether tracing is off and something was read
is done after the block on the pipe, it is hit or miss if the EOF is
returned or not leading to inconsistent behavior.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index cb41e98..e058c60 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4237,15 +4237,6 @@ static int tracing_wait_pipe(struct file *filp)
return -EAGAIN;
}
- mutex_unlock(&iter->mutex);
-
- iter->trace->wait_pipe(iter);
-
- mutex_lock(&iter->mutex);
-
- if (signal_pending(current))
- return -EINTR;
-
/*
* We block until we read something and tracing is disabled.
* We still block if tracing is disabled, but we have never
@@ -4257,6 +4248,15 @@ static int tracing_wait_pipe(struct file *filp)
*/
if (!tracing_is_on() && iter->pos)
break;
+
+ mutex_unlock(&iter->mutex);
+
+ iter->trace->wait_pipe(iter);
+
+ mutex_lock(&iter->mutex);
+
+ if (signal_pending(current))
+ return -EINTR;
}
return 1;
--
1.8.5.3
next prev parent reply other threads:[~2014-04-30 12:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 12:41 [for-next][PATCH 0/4] tracing: Updates for 3.16 Steven Rostedt
2014-04-30 12:41 ` [for-next][PATCH 1/4] tracing/stack_trace: Skip 4 instead of 3 when using ftrace_ops_list_func Steven Rostedt
2014-04-30 12:41 ` [for-next][PATCH 2/4] tracing: Fix documentation of ftrace_set_global_{filter,notrace}() Steven Rostedt
2014-04-30 12:41 ` Steven Rostedt [this message]
2014-04-30 12:41 ` [for-next][PATCH 4/4] tracing: Remove mock up poll wait function Steven Rostedt
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=20140430124231.304968038@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.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
all inboxes | Powered by JetHome®