Skip to content

Commit fa9db65

Browse files
committed
Merge tag 'for-5.20/block-2022-08-04' of git://git.kernel.dk/linux-block
Pull block driver updates from Jens Axboe: - NVMe pull requests via Christoph: - add support for In-Band authentication (Hannes Reinecke) - handle the persistent internal error AER (Michael Kelley) - use in-capsule data for TCP I/O queue connect (Caleb Sander) - remove timeout for getting RDMA-CM established event (Israel Rukshin) - misc cleanups (Joel Granados, Sagi Grimberg, Chaitanya Kulkarni, Guixin Liu, Xiang wangx) - use command_id instead of req->tag in trace_nvme_complete_rq() (Bean Huo) - various fixes for the new authentication code (Lukas Bulwahn, Dan Carpenter, Colin Ian King, Chaitanya Kulkarni, Hannes Reinecke) - small cleanups (Liu Song, Christoph Hellwig) - restore compat_ioctl support (Nick Bowler) - make a nvmet-tcp workqueue lockdep-safe (Sagi Grimberg) - enable generic interface (/dev/ngXnY) for unknown command sets (Joel Granados, Christoph Hellwig) - don't always build constants.o (Christoph Hellwig) - print the command name of aborted commands (Christoph Hellwig) - MD pull requests via Song: - Improve raid5 lock contention, by Logan Gunthorpe. - Misc fixes to raid5, by Logan Gunthorpe. - Fix race condition with md_reap_sync_thread(), by Guoqing Jiang. - Fix potential deadlock with raid5_quiesce and raid5_get_active_stripe, by Logan Gunthorpe. - Refactoring md_alloc(), by Christoph" - Fix md disk_name lifetime problems, by Christoph Hellwig - Convert prepare_to_wait() to wait_woken() api, by Logan Gunthorpe; - Fix sectors_to_do bitmap issue, by Logan Gunthorpe. - Work on unifying the null_blk module parameters and configfs API (Vincent) - drbd bitmap IO error fix (Lars) - Set of rnbd fixes (Guoqing, Md Haris) - Remove experimental marker on bcache async device registration (Coly) - Series from cleaning up the bio splitting (Christoph) - Removal of the sx8 block driver. This hardware never really widespread, and it didn't receive a lot of attention after the initial merge of it back in 2005 (Christoph) - A few fixes for s390 dasd (Eric, Jiang) - Followup set of fixes for ublk (Ming) - Support for UBLK_IO_NEED_GET_DATA for ublk (ZiyangZhang) - Fixes for the dio dma alignment (Keith) - Misc fixes and cleanups (Ming, Yu, Dan, Christophe * tag 'for-5.20/block-2022-08-04' of git://git.kernel.dk/linux-block: (136 commits) s390/dasd: Establish DMA alignment s390/dasd: drop unexpected word 'for' in comments ublk_drv: add support for UBLK_IO_NEED_GET_DATA ublk_cmd.h: add one new ublk command: UBLK_IO_NEED_GET_DATA ublk_drv: cleanup ublksrv_ctrl_dev_info ublk_drv: add SET_PARAMS/GET_PARAMS control command ublk_drv: fix ublk device leak in case that add_disk fails ublk_drv: cancel device even though disk isn't up block: fix leaking page ref on truncated direct io block: ensure bio_iov_add_page can't fail block: ensure iov_iter advances for added pages drivers:md:fix a potential use-after-free bug md/raid5: Ensure batch_last is released before sleeping for quiesce md/raid5: Move stripe_request_ctx up md/raid5: Drop unnecessary call to r5c_check_stripe_cache_usage() md/raid5: Make is_inactive_blocked() helper md/raid5: Refactor raid5_get_active_stripe() block: pass struct queue_limits to the bio splitting helpers block: move bio_allowed_max_sectors to blk-merge.c block: move the call to get_max_io_size out of blk_bio_segment_split ...
2 parents e495274 + bc79288 commit fa9db65

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+5640
-2856
lines changed

Documentation/block/null_blk.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,28 @@ submit_queues=[1..nr_cpus]: Default: 1
7272
hw_queue_depth=[0..qdepth]: Default: 64
7373
The hardware queue depth of the device.
7474

75+
memory_backed=[0/1]: Default: 0
76+
Whether or not to use a memory buffer to respond to IO requests
77+
78+
= =============================================
79+
0 Transfer no data in response to IO requests
80+
1 Use a memory buffer to respond to IO requests
81+
= =============================================
82+
83+
discard=[0/1]: Default: 0
84+
Support discard operations (requires memory-backed null_blk device).
85+
86+
= =====================================
87+
0 Do not support discard operations
88+
1 Enable support for discard operations
89+
= =====================================
90+
91+
cache_size=[Size in MB]: Default: 0
92+
Cache size in MB for memory-backed device.
93+
94+
mbps=[Maximum bandwidth in MB/s]: Default: 0 (no limit)
95+
Bandwidth limit for device performance.
96+
7597
Multi-queue specific parameters
7698
-------------------------------
7799

MAINTAINERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14507,7 +14507,8 @@ S: Supported
1450714507
W: http://git.infradead.org/nvme.git
1450814508
T: git://git.infradead.org/nvme.git
1450914509
F: drivers/nvme/host/
14510-
F: include/linux/nvme.h
14510+
F: drivers/nvme/common/
14511+
F: include/linux/nvme*
1451114512
F: include/uapi/linux/nvme_ioctl.h
1451214513

1451314514
NVM EXPRESS FC TRANSPORT DRIVERS
@@ -18838,6 +18839,7 @@ SOFTWARE RAID (Multiple Disks) SUPPORT
1883818839
M: Song Liu <[email protected]>
1883918840
1884018841
S: Supported
18842+
Q: https://patchwork.kernel.org/project/linux-raid/list/
1884118843
T: git git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git
1884218844
F: drivers/md/Kconfig
1884318845
F: drivers/md/Makefile

block/bio-integrity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,
134134
iv = bip->bip_vec + bip->bip_vcnt;
135135

136136
if (bip->bip_vcnt &&
137-
bvec_gap_to_prev(bdev_get_queue(bio->bi_bdev),
137+
bvec_gap_to_prev(&bdev_get_queue(bio->bi_bdev)->limits,
138138
&bip->bip_vec[bip->bip_vcnt - 1], offset))
139139
return 0;
140140

block/bio.c

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio,
965965
* would create a gap, disallow it.
966966
*/
967967
bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
968-
if (bvec_gap_to_prev(q, bvec, offset))
968+
if (bvec_gap_to_prev(&q->limits, bvec, offset))
969969
return 0;
970970
}
971971

@@ -1151,22 +1151,12 @@ void bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter)
11511151
bio_set_flag(bio, BIO_CLONED);
11521152
}
11531153

1154-
static void bio_put_pages(struct page **pages, size_t size, size_t off)
1155-
{
1156-
size_t i, nr = DIV_ROUND_UP(size + (off & ~PAGE_MASK), PAGE_SIZE);
1157-
1158-
for (i = 0; i < nr; i++)
1159-
put_page(pages[i]);
1160-
}
1161-
11621154
static int bio_iov_add_page(struct bio *bio, struct page *page,
11631155
unsigned int len, unsigned int offset)
11641156
{
11651157
bool same_page = false;
11661158

11671159
if (!__bio_try_merge_page(bio, page, len, offset, &same_page)) {
1168-
if (WARN_ON_ONCE(bio_full(bio, len)))
1169-
return -EINVAL;
11701160
__bio_add_page(bio, page, len, offset);
11711161
return 0;
11721162
}
@@ -1209,8 +1199,9 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
12091199
struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
12101200
struct page **pages = (struct page **)bv;
12111201
ssize_t size, left;
1212-
unsigned len, i;
1202+
unsigned len, i = 0;
12131203
size_t offset;
1204+
int ret = 0;
12141205

12151206
/*
12161207
* Move page array up in the allocated memory for the bio vecs as far as
@@ -1227,32 +1218,40 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
12271218
* result to ensure the bio's total size is correct. The remainder of
12281219
* the iov data will be picked up in the next bio iteration.
12291220
*/
1230-
size = iov_iter_get_pages(iter, pages, LONG_MAX, nr_pages, &offset);
1231-
if (size > 0)
1221+
size = iov_iter_get_pages(iter, pages, UINT_MAX - bio->bi_iter.bi_size,
1222+
nr_pages, &offset);
1223+
if (size > 0) {
1224+
nr_pages = DIV_ROUND_UP(offset + size, PAGE_SIZE);
12321225
size = ALIGN_DOWN(size, bdev_logical_block_size(bio->bi_bdev));
1233-
if (unlikely(size <= 0))
1234-
return size ? size : -EFAULT;
1226+
} else
1227+
nr_pages = 0;
1228+
1229+
if (unlikely(size <= 0)) {
1230+
ret = size ? size : -EFAULT;
1231+
goto out;
1232+
}
12351233

12361234
for (left = size, i = 0; left > 0; left -= len, i++) {
12371235
struct page *page = pages[i];
1238-
int ret;
12391236

12401237
len = min_t(size_t, PAGE_SIZE - offset, left);
1241-
if (bio_op(bio) == REQ_OP_ZONE_APPEND)
1238+
if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
12421239
ret = bio_iov_add_zone_append_page(bio, page, len,
12431240
offset);
1244-
else
1245-
ret = bio_iov_add_page(bio, page, len, offset);
1241+
if (ret)
1242+
break;
1243+
} else
1244+
bio_iov_add_page(bio, page, len, offset);
12461245

1247-
if (ret) {
1248-
bio_put_pages(pages + i, left, offset);
1249-
return ret;
1250-
}
12511246
offset = 0;
12521247
}
12531248

1254-
iov_iter_advance(iter, size);
1255-
return 0;
1249+
iov_iter_advance(iter, size - left);
1250+
out:
1251+
while (i < nr_pages)
1252+
put_page(pages[i++]);
1253+
1254+
return ret;
12561255
}
12571256

12581257
/**

block/blk-core.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ static void blk_timeout_work(struct work_struct *work)
377377
struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu)
378378
{
379379
struct request_queue *q;
380-
int ret;
381380

382381
q = kmem_cache_alloc_node(blk_get_queue_kmem_cache(alloc_srcu),
383382
GFP_KERNEL | __GFP_ZERO, node_id);
@@ -396,13 +395,9 @@ struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu)
396395
if (q->id < 0)
397396
goto fail_srcu;
398397

399-
ret = bioset_init(&q->bio_split, BIO_POOL_SIZE, 0, 0);
400-
if (ret)
401-
goto fail_id;
402-
403398
q->stats = blk_alloc_queue_stats();
404399
if (!q->stats)
405-
goto fail_split;
400+
goto fail_id;
406401

407402
q->node = node_id;
408403

@@ -439,8 +434,6 @@ struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu)
439434

440435
fail_stats:
441436
blk_free_queue_stats(q->stats);
442-
fail_split:
443-
bioset_exit(&q->bio_split);
444437
fail_id:
445438
ida_free(&blk_queue_ida, q->id);
446439
fail_srcu:

0 commit comments

Comments
 (0)