Exactly the same sector number and length must be passed to both calls of dm_stats_account_io, otherwise its per-zone in_flight counters go out of sync. This patch fixes it. Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> --- drivers/md/dm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) Index: linux-dm/drivers/md/dm.c =================================================================== --- linux-dm.orig/drivers/md/dm.c 2022-02-11 15:32:56.000000000 +0100 +++ linux-dm/drivers/md/dm.c 2022-02-11 15:40:11.000000000 +0100 @@ -487,16 +487,20 @@ EXPORT_SYMBOL_GPL(dm_start_time_ns_from_ static void start_io_acct(struct dm_io *io, struct bio *bio) { + struct bio *orig_bio; + /* Ensure IO accounting is only ever started once */ if (xchg(&io->was_accounted, 1) == 1) return; + orig_bio = io->orig_bio; + bio_start_io_acct_remapped(bio, io->start_time, - io->orig_bio->bi_bdev); + orig_bio->bi_bdev); if (unlikely(dm_stats_used(&io->md->stats))) - dm_stats_account_io(&io->md->stats, bio_data_dir(bio), - bio->bi_iter.bi_sector, bio_sectors(bio), + dm_stats_account_io(&io->md->stats, bio_data_dir(orig_bio), + orig_bio->bi_iter.bi_sector, bio_sectors(orig_bio), false, 0, &io->stats_aux); } -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel