Skip to contentSkip to conversation

blktrace: Fix output non-blktrace event when blk_classic option enabled

PATCH Applied Yang Jihong 2 participants 5 messages Nov 22, 2022 – Dec 9, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 c71a89615411 ("blktrace: add ftrace plugin")
---
 kernel/trace/blktrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/blktrace.c +2 -1
index a995ea1ef849..a66cff5a1857 100644
@@ -1548,7 +1548,8 @@ blk_trace_event_print_binary(struct trace_iterator *iter, int flags,
 
 static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)
 {
-	if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
+	if ((iter->ent->type != TRACE_BLK) ||
+	    !(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
 		return TRACE_TYPE_UNHANDLED;
 
 	return print_one_line(iter, true);
Signature · 1 line
2.30.GIT
#1 lore raw

Hello,

PING.

Thanks,
Yang.

Quoted 32 lines · Yang Jihong

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 c71a89615411 ("blktrace: add ftrace plugin")
---
  kernel/trace/blktrace.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/blktrace.c +2 -1
index a995ea1ef849..a66cff5a1857 100644
@@ -1548,7 +1548,8 @@ blk_trace_event_print_binary(struct trace_iterator *iter, int flags,
 
  static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)
  {
-	if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
+	if ((iter->ent->type != TRACE_BLK) ||
+	    !(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
  		return TRACE_TYPE_UNHANDLED;
 
  	return print_one_line(iter, true);
maintainer
#2 lore raw
Quoted 3 lines · Yang Jihong

Hello,

PING.

Get your company email fixed so that messages don't get marked as spam, that would help ensure your patches are more visible.

Signature · 1 line
Jens Axboe
#3 lore raw

Hello,

Quoted 2 lines · Jens Axboe

Get your company email fixed so that messages don't get marked as spam, that would help ensure your patches are more visible.

OK, I'll consult with the relevant department of our company about this issue.

Thanks,
Yang

maintainer Applied
#4 lore raw
In reply to Yang Jihong
Quoted 4 lines · Yang Jihong

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.

Quoted 8 lines

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

[...]

Applied, thanks!

[1/1] blktrace: Fix output non-blktrace event when blk_classic option enabled

      commit: f596da3efaf4130ff61cd029558845808df9bf99

Best regards,

Signature · 1 line
Jens Axboe