lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250423024959.2051923-1-tanzheng@kylinos.cn>
Date: Wed, 23 Apr 2025 10:49:59 +0800
From: tanzheng <tanzheng@...inos.cn>
To: axboe@...nel.dk
Cc: linux-block@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	tanzheng <tanzheng@...inos.cn>
Subject: [PATCH v1] block: Fix bio complete cannot be traced

Now all bio that enters bio_endio through blk_update_request
and blk_mq_end_request_batch will not be traced because the
BIO_TRACE_COMPLETION flag has been cleared before entering
bio_endio.

To fix it, BIO_TRACE_COMPLETION needs to be cleared after bio_endio.

Signed-off-by: Zheng tan <tanzheng@...inos.cn>
---
 block/blk-mq.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index ae8494d88897..17c19eaf8f1e 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -876,13 +876,14 @@ static void blk_complete_request(struct request *req)
 	do {
 		struct bio *next = bio->bi_next;
 
-		/* Completion has already been traced */
-		bio_clear_flag(bio, BIO_TRACE_COMPLETION);
-
 		blk_zone_update_request_bio(req, bio);
 
 		if (!is_flush)
 			bio_endio(bio);
+
+		/* Completion has already been traced */
+		bio_clear_flag(bio, BIO_TRACE_COMPLETION);
+
 		bio = next;
 	} while (bio);
 
@@ -969,8 +970,6 @@ bool blk_update_request(struct request *req, blk_status_t error,
 			bio->bi_status = BLK_STS_IOERR;
 		}
 
-		/* Completion has already been traced */
-		bio_clear_flag(bio, BIO_TRACE_COMPLETION);
 		if (unlikely(quiet))
 			bio_set_flag(bio, BIO_QUIET);
 
@@ -983,6 +982,9 @@ bool blk_update_request(struct request *req, blk_status_t error,
 				bio_endio(bio);
 		}
 
+		/* Completion has already been traced */
+		bio_clear_flag(bio, BIO_TRACE_COMPLETION);
+
 		total_bytes += bio_bytes;
 		nr_bytes -= bio_bytes;
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ