Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-5.15/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device mapper fixes from Mike Snitzer:

- Fix DM verity target to skip redundant processing on I/O errors.

- Fix request-based DM so that it doesn't queue request to blk-mq when
DM device is suspended.

- Fix DM core mempool NULL pointer race when completing IO.

- Make DM clone target's 'descs' array static.

* tag 'for-5.15/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm: fix mempool NULL pointer race when completing IO
dm rq: don't queue request to blk-mq during DM suspend
dm clone: make array 'descs' static
dm verity: skip redundant verity_handle_err() on I/O errors

+31 -11
+1 -1
drivers/md/dm-clone-target.c
··· 161 161 162 162 static void __set_clone_mode(struct clone *clone, enum clone_metadata_mode new_mode) 163 163 { 164 - const char *descs[] = { 164 + static const char * const descs[] = { 165 165 "read-write", 166 166 "read-only", 167 167 "fail"
+8
drivers/md/dm-rq.c
··· 490 490 struct mapped_device *md = tio->md; 491 491 struct dm_target *ti = md->immutable_target; 492 492 493 + /* 494 + * blk-mq's unquiesce may come from outside events, such as 495 + * elevator switch, updating nr_requests or others, and request may 496 + * come during suspend, so simply ask for blk-mq to requeue it. 497 + */ 498 + if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) 499 + return BLK_STS_RESOURCE; 500 + 493 501 if (unlikely(!ti)) { 494 502 int srcu_idx; 495 503 struct dm_table *map = dm_get_live_table(md, &srcu_idx);
+12 -3
drivers/md/dm-verity-target.c
··· 475 475 struct bvec_iter start; 476 476 unsigned b; 477 477 struct crypto_wait wait; 478 + struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); 478 479 479 480 for (b = 0; b < io->n_blocks; b++) { 480 481 int r; ··· 530 529 else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA, 531 530 cur_block, NULL, &start) == 0) 532 531 continue; 533 - else if (verity_handle_err(v, DM_VERITY_BLOCK_TYPE_DATA, 534 - cur_block)) 535 - return -EIO; 532 + else { 533 + if (bio->bi_status) { 534 + /* 535 + * Error correction failed; Just return error 536 + */ 537 + return -EIO; 538 + } 539 + if (verity_handle_err(v, DM_VERITY_BLOCK_TYPE_DATA, 540 + cur_block)) 541 + return -EIO; 542 + } 536 543 } 537 544 538 545 return 0;
+10 -7
drivers/md/dm.c
··· 496 496 false, 0, &io->stats_aux); 497 497 } 498 498 499 - static void end_io_acct(struct dm_io *io) 499 + static void end_io_acct(struct mapped_device *md, struct bio *bio, 500 + unsigned long start_time, struct dm_stats_aux *stats_aux) 500 501 { 501 - struct mapped_device *md = io->md; 502 - struct bio *bio = io->orig_bio; 503 - unsigned long duration = jiffies - io->start_time; 502 + unsigned long duration = jiffies - start_time; 504 503 505 - bio_end_io_acct(bio, io->start_time); 504 + bio_end_io_acct(bio, start_time); 506 505 507 506 if (unlikely(dm_stats_used(&md->stats))) 508 507 dm_stats_account_io(&md->stats, bio_data_dir(bio), 509 508 bio->bi_iter.bi_sector, bio_sectors(bio), 510 - true, duration, &io->stats_aux); 509 + true, duration, stats_aux); 511 510 512 511 /* nudge anyone waiting on suspend queue */ 513 512 if (unlikely(wq_has_sleeper(&md->wait))) ··· 789 790 blk_status_t io_error; 790 791 struct bio *bio; 791 792 struct mapped_device *md = io->md; 793 + unsigned long start_time = 0; 794 + struct dm_stats_aux stats_aux; 792 795 793 796 /* Push-back supersedes any I/O errors */ 794 797 if (unlikely(error)) { ··· 822 821 } 823 822 824 823 io_error = io->status; 825 - end_io_acct(io); 824 + start_time = io->start_time; 825 + stats_aux = io->stats_aux; 826 826 free_io(md, io); 827 + end_io_acct(md, bio, start_time, &stats_aux); 827 828 828 829 if (io_error == BLK_STS_DM_REQUEUE) 829 830 return;