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

Pull device mapper fixes from Mike Snitzer:

- a stable fix in both DM crypt and DM log-writes for too large bios
(as generated by bcache)

- two other stable fixes for DM log-writes

- a stable fix for a DM crypt bug that could result in freeing pointers
from uninitialized memory in the tfm allocation error path

- a DM bufio cleanup to discontinue using create_singlethread_workqueue()

* tag 'dm-4.8-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm bufio: remove use of deprecated create_singlethread_workqueue()
dm crypt: fix free of bad values after tfm allocation failure
dm crypt: fix error with too large bios
dm log writes: fix check of kthread_run() return value
dm log writes: fix bug with too large bios
dm log writes: move IO accounting earlier to fix error path

+14 -7
+1 -1
drivers/md/dm-bufio.c
··· 1879 1879 __cache_size_refresh(); 1880 1880 mutex_unlock(&dm_bufio_clients_lock); 1881 1881 1882 - dm_bufio_wq = create_singlethread_workqueue("dm_bufio_cache"); 1882 + dm_bufio_wq = alloc_workqueue("dm_bufio_cache", WQ_MEM_RECLAIM, 0); 1883 1883 if (!dm_bufio_wq) 1884 1884 return -ENOMEM; 1885 1885
+8 -1
drivers/md/dm-crypt.c
··· 1453 1453 unsigned i; 1454 1454 int err; 1455 1455 1456 - cc->tfms = kmalloc(cc->tfms_count * sizeof(struct crypto_skcipher *), 1456 + cc->tfms = kzalloc(cc->tfms_count * sizeof(struct crypto_skcipher *), 1457 1457 GFP_KERNEL); 1458 1458 if (!cc->tfms) 1459 1459 return -ENOMEM; ··· 1923 1923 dm_target_offset(ti, bio->bi_iter.bi_sector); 1924 1924 return DM_MAPIO_REMAPPED; 1925 1925 } 1926 + 1927 + /* 1928 + * Check if bio is too large, split as needed. 1929 + */ 1930 + if (unlikely(bio->bi_iter.bi_size > (BIO_MAX_PAGES << PAGE_SHIFT)) && 1931 + bio_data_dir(bio) == WRITE) 1932 + dm_accept_partial_bio(bio, ((BIO_MAX_PAGES << PAGE_SHIFT) >> SECTOR_SHIFT)); 1926 1933 1927 1934 io = dm_per_bio_data(bio, cc->per_bio_data_size); 1928 1935 crypt_io_init(io, cc, bio, dm_target_offset(ti, bio->bi_iter.bi_sector));
+5 -5
drivers/md/dm-log-writes.c
··· 259 259 goto out; 260 260 sector++; 261 261 262 - bio = bio_alloc(GFP_KERNEL, block->vec_cnt); 262 + atomic_inc(&lc->io_blocks); 263 + bio = bio_alloc(GFP_KERNEL, min(block->vec_cnt, BIO_MAX_PAGES)); 263 264 if (!bio) { 264 265 DMERR("Couldn't alloc log bio"); 265 266 goto error; 266 267 } 267 - atomic_inc(&lc->io_blocks); 268 268 bio->bi_iter.bi_size = 0; 269 269 bio->bi_iter.bi_sector = sector; 270 270 bio->bi_bdev = lc->logdev->bdev; ··· 282 282 if (ret != block->vecs[i].bv_len) { 283 283 atomic_inc(&lc->io_blocks); 284 284 submit_bio(bio); 285 - bio = bio_alloc(GFP_KERNEL, block->vec_cnt - i); 285 + bio = bio_alloc(GFP_KERNEL, min(block->vec_cnt - i, BIO_MAX_PAGES)); 286 286 if (!bio) { 287 287 DMERR("Couldn't alloc log bio"); 288 288 goto error; ··· 459 459 goto bad; 460 460 } 461 461 462 - ret = -EINVAL; 463 462 lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write"); 464 - if (!lc->log_kthread) { 463 + if (IS_ERR(lc->log_kthread)) { 464 + ret = PTR_ERR(lc->log_kthread); 465 465 ti->error = "Couldn't alloc kthread"; 466 466 dm_put_device(ti, lc->dev); 467 467 dm_put_device(ti, lc->logdev);