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 'io_uring-6.18-20251113' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull io_uring fixes from Jens Axboe:

- Use the actual segments in a request when for bvec based buffers

- Fix an odd case where the iovec might get leaked for a read/write
request, if it was newly allocated, overflowed the alloc cache, and
hit an early error

- Minor tweak to the query API added in this release, returning the
number of available entries

* tag 'io_uring-6.18-20251113' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
io_uring/rsrc: don't use blk_rq_nr_phys_segments() as number of bvecs
io_uring/query: return number of available queries
io_uring/rw: ensure allocated iovec gets cleared for early failure

+17 -7
+3
include/uapi/linux/io_uring/query.h
··· 36 36 __u64 enter_flags; 37 37 /* Bitmask of all supported IOSQE_* flags */ 38 38 __u64 sqe_flags; 39 + /* The number of available query opcodes */ 40 + __u32 nr_query_opcodes; 41 + __u32 __pad; 39 42 }; 40 43 41 44 #endif
+2
io_uring/query.c
··· 20 20 e->ring_setup_flags = IORING_SETUP_FLAGS; 21 21 e->enter_flags = IORING_ENTER_FLAGS; 22 22 e->sqe_flags = SQE_VALID_FLAGS; 23 + e->nr_query_opcodes = __IO_URING_QUERY_MAX; 24 + e->__pad = 0; 23 25 return sizeof(*e); 24 26 } 25 27
+9 -7
io_uring/rsrc.c
··· 943 943 struct req_iterator rq_iter; 944 944 struct io_mapped_ubuf *imu; 945 945 struct io_rsrc_node *node; 946 - struct bio_vec bv, *bvec; 947 - u16 nr_bvecs; 946 + struct bio_vec bv; 947 + unsigned int nr_bvecs = 0; 948 948 int ret = 0; 949 949 950 950 io_ring_submit_lock(ctx, issue_flags); ··· 965 965 goto unlock; 966 966 } 967 967 968 - nr_bvecs = blk_rq_nr_phys_segments(rq); 969 - imu = io_alloc_imu(ctx, nr_bvecs); 968 + /* 969 + * blk_rq_nr_phys_segments() may overestimate the number of bvecs 970 + * but avoids needing to iterate over the bvecs 971 + */ 972 + imu = io_alloc_imu(ctx, blk_rq_nr_phys_segments(rq)); 970 973 if (!imu) { 971 974 kfree(node); 972 975 ret = -ENOMEM; ··· 980 977 imu->len = blk_rq_bytes(rq); 981 978 imu->acct_pages = 0; 982 979 imu->folio_shift = PAGE_SHIFT; 983 - imu->nr_bvecs = nr_bvecs; 984 980 refcount_set(&imu->refs, 1); 985 981 imu->release = release; 986 982 imu->priv = rq; 987 983 imu->is_kbuf = true; 988 984 imu->dir = 1 << rq_data_dir(rq); 989 985 990 - bvec = imu->bvec; 991 986 rq_for_each_bvec(bv, rq, rq_iter) 992 - *bvec++ = bv; 987 + imu->bvec[nr_bvecs++] = bv; 988 + imu->nr_bvecs = nr_bvecs; 993 989 994 990 node->buf = imu; 995 991 data->nodes[index] = node;
+3
io_uring/rw.c
··· 463 463 464 464 void io_readv_writev_cleanup(struct io_kiocb *req) 465 465 { 466 + struct io_async_rw *rw = req->async_data; 467 + 466 468 lockdep_assert_held(&req->ctx->uring_lock); 469 + io_vec_free(&rw->vec); 467 470 io_rw_recycle(req, 0); 468 471 } 469 472