Patch "md/raid10: fix the condition to call bio_end_io_acct()" has been added to the 6.4-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    md/raid10: fix the condition to call bio_end_io_acct()

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     md-raid10-fix-the-condition-to-call-bio_end_io_acct.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 75d6713a879b1ca713ab30b4a0d3da59e8e445fc
Author: Li Nan <linan122@xxxxxxxxxx>
Date:   Fri Jun 9 17:43:20 2023 +0800

    md/raid10: fix the condition to call bio_end_io_acct()
    
    [ Upstream commit 125bfc7cd750e68c99f1d446e2c22abea08c237f ]
    
    /sys/block/[device]/queue/iostats is used to control whether to count io
    stat. Write 0 to it will clear queue_flags QUEUE_FLAG_IO_STAT which means
    iostats is disabled. If we disable iostats and later endable it, the io
    issued during this period will be counted incorrectly, inflight will be
    decreased to -1.
    
      //T1 set iostats
      echo 0 > /sys/block/md0/queue/iostats
       clear QUEUE_FLAG_IO_STAT
    
                            //T2 issue io
                            if (QUEUE_FLAG_IO_STAT) -> false
                             bio_start_io_acct
                              inflight++
    
      echo 1 > /sys/block/md0/queue/iostats
       set QUEUE_FLAG_IO_STAT
    
                                            //T3 io end
                                            if (QUEUE_FLAG_IO_STAT) -> true
                                             bio_end_io_acct
                                              inflight--    -> -1
    
    Also, if iostats is enabled while issuing io but disabled while io end,
    inflight will never be decreased.
    
    Fix it by checking start_time when io end. If start_time is not 0, call
    bio_end_io_acct().
    
    Fixes: 528bc2cf2fcc ("md/raid10: enable io accounting")
    Signed-off-by: Li Nan <linan122@xxxxxxxxxx>
    Signed-off-by: Song Liu <song@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230609094320.2397604-1-linan666@xxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 9d11a52367d17..9d23963496194 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -325,7 +325,7 @@ static void raid_end_bio_io(struct r10bio *r10_bio)
 	if (!test_bit(R10BIO_Uptodate, &r10_bio->state))
 		bio->bi_status = BLK_STS_IOERR;
 
-	if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
+	if (r10_bio->start_time)
 		bio_end_io_acct(bio, r10_bio->start_time);
 	bio_endio(bio);
 	/*



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux