Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5288148rwb; Mon, 21 Nov 2022 20:15:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf71Lqax+HLjU43hh5u31dA6BfzhFpMk7mR9Z/tLP+IwTku1W5eROZxceMeFBCCmW9ZVUFFy X-Received: by 2002:a17:902:aa0c:b0:188:d7f5:20df with SMTP id be12-20020a170902aa0c00b00188d7f520dfmr1991412plb.120.1669090528773; Mon, 21 Nov 2022 20:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669090528; cv=none; d=google.com; s=arc-20160816; b=qcfUGC1zX64aR40fnV7tas8QKrncsBQoTFmeOM5YGfDOXSWuLRbsSeqW7OLflKk7tF YQ20GSWMa1ROS4bEyOrD2kFa0QnAUy2tghjme9Z5HKAWtvTq4IWGsb1x0QdgL8nMSdvQ yt72Wk+SVX0sW+i4ECUvbvYzjao/jxiIbTpsOSHiBKFuJuV+7SYTyNh71PRboTGHjL52 Uu+gxzlMmbERuHNAJ7P1ftTFLa1gsmBjDnOM9aCySbEc2kMtukKhqqf3D61N2ACEFPw7 3RtwoHp+LyjgtSnUQzrdVGDIl8EAI9OCMVKIP7qg+baYb8gerJOxv+P2XWFxuR0wmOWS WD1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=tpfTHqDN7m60fttkrQBgre9l9w27OvHuL3PlZ6BGvJo=; b=wsYeun2dCpaLxInoV7ve+OtAYBqPvVey/J32F/R+11fMIy1XTAat/iZjXE2hCsEsL2 dR+d3bq7EP8w2eolEiTDsMWNGQDVlDyecPXWzAeflgb2qQqvINRbjVxcC0HL3SpeAmEC YU3ZcgoJZwEOPW1fHrzzC9W31o1Pv/lfIUOSpRbld2m9DLDEuUHqMx7y3rfBzUJxSdMT a97Sm4ZNahvRgcv3izgo/MULymjjAL/hgP2I11gPM9h5DsdU84Z9lbwWaCusDqZChWKL Obvs6nUueh4Jz3eZXZ0TbaBv/XAtHEloozQS1+HCTcGz+m+73MfVhiCUmsl/paxENMJo jggQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm9-20020a056a00338900b0056be3109462si12275394pfb.163.2022.11.21.20.15.13; Mon, 21 Nov 2022 20:15:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbiKVEHW (ORCPT + 92 others); Mon, 21 Nov 2022 23:07:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbiKVEHQ (ORCPT ); Mon, 21 Nov 2022 23:07:16 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1A092E9DB; Mon, 21 Nov 2022 20:07:15 -0800 (PST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NGW0h5yybz15MpB; Tue, 22 Nov 2022 12:06:44 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 12:07:13 +0800 Received: from ubuntu1804.huawei.com (10.67.174.61) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 12:07:13 +0800 From: Yang Jihong To: , , , , , , CC: Subject: [PATCH] blktrace: Fix output non-blktrace event when blk_classic option enabled Date: Tue, 22 Nov 2022 12:04:10 +0800 Message-ID: <20221122040410.85113-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.61] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/trace/blktrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index a995ea1ef849..a66cff5a1857 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -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); -- 2.30.GIT