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

Pull device mapper fixes from Mike Snitzer:
"Fix dm bufio shrinker to properly zero-fill all fields.

Fix race in dm cache that caused improper reporting of the number of
dirty blocks in the cache"

* tag 'dm-3.16-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm cache: fix race affecting dirty block count
dm bufio: fully initialize shrinker

+7 -8
+1 -1
drivers/md/dm-bufio.c
··· 1541 1541 BUG_ON(block_size < 1 << SECTOR_SHIFT || 1542 1542 (block_size & (block_size - 1))); 1543 1543 1544 - c = kmalloc(sizeof(*c), GFP_KERNEL); 1544 + c = kzalloc(sizeof(*c), GFP_KERNEL); 1545 1545 if (!c) { 1546 1546 r = -ENOMEM; 1547 1547 goto bad_client;
+6 -7
drivers/md/dm-cache-target.c
··· 231 231 /* 232 232 * cache_size entries, dirty if set 233 233 */ 234 - dm_cblock_t nr_dirty; 234 + atomic_t nr_dirty; 235 235 unsigned long *dirty_bitset; 236 236 237 237 /* ··· 492 492 static void set_dirty(struct cache *cache, dm_oblock_t oblock, dm_cblock_t cblock) 493 493 { 494 494 if (!test_and_set_bit(from_cblock(cblock), cache->dirty_bitset)) { 495 - cache->nr_dirty = to_cblock(from_cblock(cache->nr_dirty) + 1); 495 + atomic_inc(&cache->nr_dirty); 496 496 policy_set_dirty(cache->policy, oblock); 497 497 } 498 498 } ··· 501 501 { 502 502 if (test_and_clear_bit(from_cblock(cblock), cache->dirty_bitset)) { 503 503 policy_clear_dirty(cache->policy, oblock); 504 - cache->nr_dirty = to_cblock(from_cblock(cache->nr_dirty) - 1); 505 - if (!from_cblock(cache->nr_dirty)) 504 + if (atomic_dec_return(&cache->nr_dirty) == 0) 506 505 dm_table_event(cache->ti->table); 507 506 } 508 507 } ··· 2268 2269 atomic_set(&cache->quiescing_ack, 0); 2269 2270 2270 2271 r = -ENOMEM; 2271 - cache->nr_dirty = 0; 2272 + atomic_set(&cache->nr_dirty, 0); 2272 2273 cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size)); 2273 2274 if (!cache->dirty_bitset) { 2274 2275 *error = "could not allocate dirty bitset"; ··· 2807 2808 2808 2809 residency = policy_residency(cache->policy); 2809 2810 2810 - DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %llu ", 2811 + DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %lu ", 2811 2812 (unsigned)(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT), 2812 2813 (unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata), 2813 2814 (unsigned long long)nr_blocks_metadata, ··· 2820 2821 (unsigned) atomic_read(&cache->stats.write_miss), 2821 2822 (unsigned) atomic_read(&cache->stats.demotion), 2822 2823 (unsigned) atomic_read(&cache->stats.promotion), 2823 - (unsigned long long) from_cblock(cache->nr_dirty)); 2824 + (unsigned long) atomic_read(&cache->nr_dirty)); 2824 2825 2825 2826 if (writethrough_mode(&cache->features)) 2826 2827 DMEMIT("1 writethrough ");