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

Pull device-mapper fixes form Mike Snitzer:
"Two small fixes for the DM cache target:

- fix corruption with >2TB fast device due to truncation bug
- fix access beyond end of origin device due to a partial block"

* tag 'dm-3.14-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm cache: fix access beyond end of origin device
dm cache: fix truncation bug when copying a block to/from >2TB fast device

+5 -6
+5 -6
drivers/md/dm-cache-target.c
··· 979 979 int r; 980 980 struct dm_io_region o_region, c_region; 981 981 struct cache *cache = mg->cache; 982 + sector_t cblock = from_cblock(mg->cblock); 982 983 983 984 o_region.bdev = cache->origin_dev->bdev; 984 985 o_region.count = cache->sectors_per_block; 985 986 986 987 c_region.bdev = cache->cache_dev->bdev; 987 - c_region.sector = from_cblock(mg->cblock) * cache->sectors_per_block; 988 + c_region.sector = cblock * cache->sectors_per_block; 988 989 c_region.count = cache->sectors_per_block; 989 990 990 991 if (mg->writeback || mg->demote) { ··· 2465 2464 bool discarded_block; 2466 2465 struct dm_bio_prison_cell *cell; 2467 2466 struct policy_result lookup_result; 2468 - struct per_bio_data *pb; 2467 + struct per_bio_data *pb = init_per_bio_data(bio, pb_data_size); 2469 2468 2470 - if (from_oblock(block) > from_oblock(cache->origin_blocks)) { 2469 + if (unlikely(from_oblock(block) >= from_oblock(cache->origin_blocks))) { 2471 2470 /* 2472 2471 * This can only occur if the io goes to a partial block at 2473 2472 * the end of the origin device. We don't cache these. 2474 2473 * Just remap to the origin and carry on. 2475 2474 */ 2476 - remap_to_origin_clear_discard(cache, bio, block); 2475 + remap_to_origin(cache, bio); 2477 2476 return DM_MAPIO_REMAPPED; 2478 2477 } 2479 - 2480 - pb = init_per_bio_data(bio, pb_data_size); 2481 2478 2482 2479 if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { 2483 2480 defer_bio(cache, bio);