[PATCH v1] block: Fix bio complete cannot be traced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux