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-6.9/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm

Pull device mapper fixes from Mike Snitzer:

- Fix a memory leak in DM integrity recheck code that was added during
the 6.9 merge. Also fix the recheck code to ensure it issues bios
with proper alignment.

- Fix DM snapshot's dm_exception_table_exit() to schedule while
handling an large exception table during snapshot device shutdown.

* tag 'for-6.9/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm-integrity: align the outgoing bio in integrity_recheck
dm snapshot: fix lockup in dm_exception_table_exit
dm-integrity: fix a memory leak when rechecking the data

+17 -7
+14 -6
drivers/md/dm-integrity.c
··· 1699 1699 struct bio_vec bv; 1700 1700 sector_t sector, logical_sector, area, offset; 1701 1701 struct page *page; 1702 - void *buffer; 1703 1702 1704 1703 get_area_and_offset(ic, dio->range.logical_sector, &area, &offset); 1705 1704 dio->metadata_block = get_metadata_sector_and_offset(ic, area, offset, ··· 1707 1708 logical_sector = dio->range.logical_sector; 1708 1709 1709 1710 page = mempool_alloc(&ic->recheck_pool, GFP_NOIO); 1710 - buffer = page_to_virt(page); 1711 1711 1712 1712 __bio_for_each_segment(bv, bio, iter, dio->bio_details.bi_iter) { 1713 1713 unsigned pos = 0; 1714 1714 1715 1715 do { 1716 + sector_t alignment; 1716 1717 char *mem; 1718 + char *buffer = page_to_virt(page); 1717 1719 int r; 1718 1720 struct dm_io_request io_req; 1719 1721 struct dm_io_region io_loc; ··· 1726 1726 io_loc.bdev = ic->dev->bdev; 1727 1727 io_loc.sector = sector; 1728 1728 io_loc.count = ic->sectors_per_block; 1729 + 1730 + /* Align the bio to logical block size */ 1731 + alignment = dio->range.logical_sector | bio_sectors(bio) | (PAGE_SIZE >> SECTOR_SHIFT); 1732 + alignment &= -alignment; 1733 + io_loc.sector = round_down(io_loc.sector, alignment); 1734 + io_loc.count += sector - io_loc.sector; 1735 + buffer += (sector - io_loc.sector) << SECTOR_SHIFT; 1736 + io_loc.count = round_up(io_loc.count, alignment); 1729 1737 1730 1738 r = dm_io(&io_req, 1, &io_loc, NULL, IOPRIO_DEFAULT); 1731 1739 if (unlikely(r)) { ··· 1856 1848 r = dm_integrity_rw_tag(ic, checksums, &dio->metadata_block, &dio->metadata_offset, 1857 1849 checksums_ptr - checksums, dio->op == REQ_OP_READ ? TAG_CMP : TAG_WRITE); 1858 1850 if (unlikely(r)) { 1859 - if (r > 0) { 1860 - integrity_recheck(dio, checksums); 1861 - goto skip_io; 1862 - } 1863 1851 if (likely(checksums != checksums_onstack)) 1864 1852 kfree(checksums); 1853 + if (r > 0) { 1854 + integrity_recheck(dio, checksums_onstack); 1855 + goto skip_io; 1856 + } 1865 1857 goto error; 1866 1858 } 1867 1859
+3 -1
drivers/md/dm-snap.c
··· 684 684 for (i = 0; i < size; i++) { 685 685 slot = et->table + i; 686 686 687 - hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list) 687 + hlist_bl_for_each_entry_safe(ex, pos, n, slot, hash_list) { 688 688 kmem_cache_free(mem, ex); 689 + cond_resched(); 690 + } 689 691 } 690 692 691 693 kvfree(et->table);