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.2-2023-01-27' of git://git.kernel.dk/linux

Pull io_uring fixes from Jens Axboe:
"Two small fixes for this release:

- Sanitize how async prep is done for drain requests, so we ensure
that it always gets done (Dylan)

- A ring provided buffer recycling fix for multishot receive (me)"

* tag 'io_uring-6.2-2023-01-27' of git://git.kernel.dk/linux:
io_uring: always prep_async for drain requests
io_uring/net: cache provided buffer group value for multishot receives

+19 -10
+8 -10
io_uring/io_uring.c
··· 1765 1765 } 1766 1766 spin_unlock(&ctx->completion_lock); 1767 1767 1768 - ret = io_req_prep_async(req); 1769 - if (ret) { 1770 - fail: 1771 - io_req_defer_failed(req, ret); 1772 - return; 1773 - } 1774 1768 io_prep_async_link(req); 1775 1769 de = kmalloc(sizeof(*de), GFP_KERNEL); 1776 1770 if (!de) { 1777 1771 ret = -ENOMEM; 1778 - goto fail; 1772 + io_req_defer_failed(req, ret); 1773 + return; 1779 1774 } 1780 1775 1781 1776 spin_lock(&ctx->completion_lock); ··· 2043 2048 req->flags &= ~REQ_F_HARDLINK; 2044 2049 req->flags |= REQ_F_LINK; 2045 2050 io_req_defer_failed(req, req->cqe.res); 2046 - } else if (unlikely(req->ctx->drain_active)) { 2047 - io_drain_req(req); 2048 2051 } else { 2049 2052 int ret = io_req_prep_async(req); 2050 2053 2051 - if (unlikely(ret)) 2054 + if (unlikely(ret)) { 2052 2055 io_req_defer_failed(req, ret); 2056 + return; 2057 + } 2058 + 2059 + if (unlikely(req->ctx->drain_active)) 2060 + io_drain_req(req); 2053 2061 else 2054 2062 io_queue_iowq(req, NULL); 2055 2063 }
+11
io_uring/net.c
··· 62 62 u16 flags; 63 63 /* initialised and used only by !msg send variants */ 64 64 u16 addr_len; 65 + u16 buf_group; 65 66 void __user *addr; 66 67 /* used only for send zerocopy */ 67 68 struct io_kiocb *notif; ··· 581 580 if (req->opcode == IORING_OP_RECV && sr->len) 582 581 return -EINVAL; 583 582 req->flags |= REQ_F_APOLL_MULTISHOT; 583 + /* 584 + * Store the buffer group for this multishot receive separately, 585 + * as if we end up doing an io-wq based issue that selects a 586 + * buffer, it has to be committed immediately and that will 587 + * clear ->buf_list. This means we lose the link to the buffer 588 + * list, and the eventual buffer put on completion then cannot 589 + * restore it. 590 + */ 591 + sr->buf_group = req->buf_index; 584 592 } 585 593 586 594 #ifdef CONFIG_COMPAT ··· 606 596 607 597 sr->done_io = 0; 608 598 sr->len = 0; /* get from the provided buffer */ 599 + req->buf_index = sr->buf_group; 609 600 } 610 601 611 602 /*