Skip to content

Commit f596da3

Browse files
Yang Jihongaxboe
authored andcommitted
blktrace: Fix output non-blktrace event when blk_classic option enabled
When the blk_classic option is enabled, non-blktrace events must be filtered out. Otherwise, events of other types are output in the blktrace classic format, which is unexpected. The problem can be triggered in the following ways: # echo 1 > /sys/kernel/debug/tracing/options/blk_classic # echo 1 > /sys/kernel/debug/tracing/events/enable # echo blk > /sys/kernel/debug/tracing/current_tracer # cat /sys/kernel/debug/tracing/trace_pipe Fixes: c71a896 ("blktrace: add ftrace plugin") Signed-off-by: Yang Jihong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 56fb8d9 commit f596da3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/trace/blktrace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,8 @@ blk_trace_event_print_binary(struct trace_iterator *iter, int flags,
15481548

15491549
static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)
15501550
{
1551-
if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
1551+
if ((iter->ent->type != TRACE_BLK) ||
1552+
!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
15521553
return TRACE_TYPE_UNHANDLED;
15531554

15541555
return print_one_line(iter, true);

0 commit comments

Comments
 (0)