blktrace: Fix output non-blktrace event when blk_classic option enabled
authorYang Jihong <yangjihong1@huawei.com>
Tue, 22 Nov 2022 04:04:10 +0000 (12:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:26 +0000 (13:32 +0100)
commit8682d0a6ee546d365f53b9d5dfb509f2ad3a2f07
treec39e6842da499114832a69896bde9baa01394460
parentbbb2d35386c11e13b19261ed7f926b305e19a07c
blktrace: Fix output non-blktrace event when blk_classic option enabled

[ Upstream commit f596da3efaf4130ff61cd029558845808df9bf99 ]

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")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Link: https://lore.kernel.org/r/20221122040410.85113-1-yangjihong1@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/blktrace.c