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 'block-5.13-2021-06-12' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
"A few fixes that should go into 5.13:

- Fix a regression deadlock introduced in this release between open
and remove of a bdev (Christoph)

- Fix an async_xor md regression in this release (Xiao)

- Fix bcache oversized read issue (Coly)"

* tag 'block-5.13-2021-06-12' of git://git.kernel.dk/linux-block:
block: loop: fix deadlock between open and remove
async_xor: check src_offs is not NULL before updating it
bcache: avoid oversized read request in cache missing code path
bcache: remove bcache device self-defined readahead

+17 -52
+2 -1
crypto/async_tx/async_xor.c
··· 233 233 if (submit->flags & ASYNC_TX_XOR_DROP_DST) { 234 234 src_cnt--; 235 235 src_list++; 236 - src_offs++; 236 + if (src_offs) 237 + src_offs++; 237 238 } 238 239 239 240 /* wait for any prerequisite operations */
+7 -18
drivers/block/loop.c
··· 1879 1879 1880 1880 static int lo_open(struct block_device *bdev, fmode_t mode) 1881 1881 { 1882 - struct loop_device *lo; 1882 + struct loop_device *lo = bdev->bd_disk->private_data; 1883 1883 int err; 1884 1884 1885 - /* 1886 - * take loop_ctl_mutex to protect lo pointer from race with 1887 - * loop_control_ioctl(LOOP_CTL_REMOVE), however, to reduce contention 1888 - * release it prior to updating lo->lo_refcnt. 1889 - */ 1890 - err = mutex_lock_killable(&loop_ctl_mutex); 1891 - if (err) 1892 - return err; 1893 - lo = bdev->bd_disk->private_data; 1894 - if (!lo) { 1895 - mutex_unlock(&loop_ctl_mutex); 1896 - return -ENXIO; 1897 - } 1898 1885 err = mutex_lock_killable(&lo->lo_mutex); 1899 - mutex_unlock(&loop_ctl_mutex); 1900 1886 if (err) 1901 1887 return err; 1902 - atomic_inc(&lo->lo_refcnt); 1888 + if (lo->lo_state == Lo_deleting) 1889 + err = -ENXIO; 1890 + else 1891 + atomic_inc(&lo->lo_refcnt); 1903 1892 mutex_unlock(&lo->lo_mutex); 1904 - return 0; 1893 + return err; 1905 1894 } 1906 1895 1907 1896 static void lo_release(struct gendisk *disk, fmode_t mode) ··· 2274 2285 mutex_unlock(&lo->lo_mutex); 2275 2286 break; 2276 2287 } 2277 - lo->lo_disk->private_data = NULL; 2288 + lo->lo_state = Lo_deleting; 2278 2289 mutex_unlock(&lo->lo_mutex); 2279 2290 idr_remove(&loop_index_idr, lo->lo_number); 2280 2291 loop_remove(lo);
+1
drivers/block/loop.h
··· 22 22 Lo_unbound, 23 23 Lo_bound, 24 24 Lo_rundown, 25 + Lo_deleting, 25 26 }; 26 27 27 28 struct loop_func_table;
-1
drivers/md/bcache/bcache.h
··· 364 364 365 365 /* The rest of this all shows up in sysfs */ 366 366 unsigned int sequential_cutoff; 367 - unsigned int readahead; 368 367 369 368 unsigned int io_disable:1; 370 369 unsigned int verify:1;
+7 -13
drivers/md/bcache/request.c
··· 880 880 struct bio *bio, unsigned int sectors) 881 881 { 882 882 int ret = MAP_CONTINUE; 883 - unsigned int reada = 0; 884 883 struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); 885 884 struct bio *miss, *cache_bio; 885 + unsigned int size_limit; 886 886 887 887 s->cache_missed = 1; 888 888 ··· 892 892 goto out_submit; 893 893 } 894 894 895 - if (!(bio->bi_opf & REQ_RAHEAD) && 896 - !(bio->bi_opf & (REQ_META|REQ_PRIO)) && 897 - s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA) 898 - reada = min_t(sector_t, dc->readahead >> 9, 899 - get_capacity(bio->bi_bdev->bd_disk) - 900 - bio_end_sector(bio)); 901 - 902 - s->insert_bio_sectors = min(sectors, bio_sectors(bio) + reada); 895 + /* Limitation for valid replace key size and cache_bio bvecs number */ 896 + size_limit = min_t(unsigned int, BIO_MAX_VECS * PAGE_SECTORS, 897 + (1 << KEY_SIZE_BITS) - 1); 898 + s->insert_bio_sectors = min3(size_limit, sectors, bio_sectors(bio)); 903 899 904 900 s->iop.replace_key = KEY(s->iop.inode, 905 901 bio->bi_iter.bi_sector + s->insert_bio_sectors, ··· 907 911 908 912 s->iop.replace = true; 909 913 910 - miss = bio_next_split(bio, sectors, GFP_NOIO, &s->d->bio_split); 914 + miss = bio_next_split(bio, s->insert_bio_sectors, GFP_NOIO, 915 + &s->d->bio_split); 911 916 912 917 /* btree_search_recurse()'s btree iterator is no good anymore */ 913 918 ret = miss == bio ? MAP_DONE : -EINTR; ··· 929 932 bch_bio_map(cache_bio, NULL); 930 933 if (bch_bio_alloc_pages(cache_bio, __GFP_NOWARN|GFP_NOIO)) 931 934 goto out_put; 932 - 933 - if (reada) 934 - bch_mark_cache_readahead(s->iop.c, s->d); 935 935 936 936 s->cache_miss = miss; 937 937 s->iop.bio = cache_bio;
-14
drivers/md/bcache/stats.c
··· 46 46 read_attribute(cache_bypass_hits); 47 47 read_attribute(cache_bypass_misses); 48 48 read_attribute(cache_hit_ratio); 49 - read_attribute(cache_readaheads); 50 49 read_attribute(cache_miss_collisions); 51 50 read_attribute(bypassed); 52 51 ··· 63 64 DIV_SAFE(var(cache_hits) * 100, 64 65 var(cache_hits) + var(cache_misses))); 65 66 66 - var_print(cache_readaheads); 67 67 var_print(cache_miss_collisions); 68 68 sysfs_hprint(bypassed, var(sectors_bypassed) << 9); 69 69 #undef var ··· 84 86 &sysfs_cache_bypass_hits, 85 87 &sysfs_cache_bypass_misses, 86 88 &sysfs_cache_hit_ratio, 87 - &sysfs_cache_readaheads, 88 89 &sysfs_cache_miss_collisions, 89 90 &sysfs_bypassed, 90 91 NULL ··· 110 113 acc->total.cache_misses = 0; 111 114 acc->total.cache_bypass_hits = 0; 112 115 acc->total.cache_bypass_misses = 0; 113 - acc->total.cache_readaheads = 0; 114 116 acc->total.cache_miss_collisions = 0; 115 117 acc->total.sectors_bypassed = 0; 116 118 } ··· 141 145 scale_stat(&stats->cache_misses); 142 146 scale_stat(&stats->cache_bypass_hits); 143 147 scale_stat(&stats->cache_bypass_misses); 144 - scale_stat(&stats->cache_readaheads); 145 148 scale_stat(&stats->cache_miss_collisions); 146 149 scale_stat(&stats->sectors_bypassed); 147 150 } ··· 163 168 move_stat(cache_misses); 164 169 move_stat(cache_bypass_hits); 165 170 move_stat(cache_bypass_misses); 166 - move_stat(cache_readaheads); 167 171 move_stat(cache_miss_collisions); 168 172 move_stat(sectors_bypassed); 169 173 ··· 201 207 202 208 mark_cache_stats(&dc->accounting.collector, hit, bypass); 203 209 mark_cache_stats(&c->accounting.collector, hit, bypass); 204 - } 205 - 206 - void bch_mark_cache_readahead(struct cache_set *c, struct bcache_device *d) 207 - { 208 - struct cached_dev *dc = container_of(d, struct cached_dev, disk); 209 - 210 - atomic_inc(&dc->accounting.collector.cache_readaheads); 211 - atomic_inc(&c->accounting.collector.cache_readaheads); 212 210 } 213 211 214 212 void bch_mark_cache_miss_collision(struct cache_set *c, struct bcache_device *d)
-1
drivers/md/bcache/stats.h
··· 7 7 atomic_t cache_misses; 8 8 atomic_t cache_bypass_hits; 9 9 atomic_t cache_bypass_misses; 10 - atomic_t cache_readaheads; 11 10 atomic_t cache_miss_collisions; 12 11 atomic_t sectors_bypassed; 13 12 };
-4
drivers/md/bcache/sysfs.c
··· 137 137 rw_attribute(discard); 138 138 rw_attribute(running); 139 139 rw_attribute(label); 140 - rw_attribute(readahead); 141 140 rw_attribute(errors); 142 141 rw_attribute(io_error_limit); 143 142 rw_attribute(io_error_halflife); ··· 259 260 var_printf(partial_stripes_expensive, "%u"); 260 261 261 262 var_hprint(sequential_cutoff); 262 - var_hprint(readahead); 263 263 264 264 sysfs_print(running, atomic_read(&dc->running)); 265 265 sysfs_print(state, states[BDEV_STATE(&dc->sb)]); ··· 363 365 sysfs_strtoul_clamp(sequential_cutoff, 364 366 dc->sequential_cutoff, 365 367 0, UINT_MAX); 366 - d_strtoi_h(readahead); 367 368 368 369 if (attr == &sysfs_clear_stats) 369 370 bch_cache_accounting_clear(&dc->accounting); ··· 535 538 &sysfs_running, 536 539 &sysfs_state, 537 540 &sysfs_label, 538 - &sysfs_readahead, 539 541 #ifdef CONFIG_BCACHE_DEBUG 540 542 &sysfs_verify, 541 543 &sysfs_bypass_torture_test,