Skip to content

Commit

Permalink
tracing: Fix regression of trace_pipe
Browse files Browse the repository at this point in the history
Commit 0fb9656 "tracing: Make tracing_enabled be equal to tracing_on"
changes the behaviour of trace_pipe, ie. it makes trace_pipe return if
we've read something and tracing is enabled, and this means that we have
to 'cat trace_pipe' again and again while running tests.

IMO the right way is if tracing is enabled, we always block and wait for
ring buffer, or we may lose what we want since ring buffer's size is limited.

Link: http://lkml.kernel.org/r/1358132051-5410-1-git-send-email-bo.li.liu@oracle.com

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Liu Bo authored and Steven Rostedt committed Jan 14, 2013
1 parent 2df8f8a commit 250bfd3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3454,15 +3454,15 @@ static int tracing_wait_pipe(struct file *filp)
return -EINTR;

/*
* We block until we read something and tracing is enabled.
* We block until we read something and tracing is disabled.
* We still block if tracing is disabled, but we have never
* read anything. This allows a user to cat this file, and
* then enable tracing. But after we have read something,
* we give an EOF when tracing is again disabled.
*
* iter->pos will be 0 if we haven't read anything.
*/
if (tracing_is_enabled() && iter->pos)
if (!tracing_is_enabled() && iter->pos)
break;
}

Expand Down

0 comments on commit 250bfd3

Please sign in to comment.