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.0-2022-09-09' of git://git.kernel.dk/linux-block

Pull io_uring fixes from Jens Axboe:

- Removed function that became unused after last week's merge (Jiapeng)

- Two small fixes for kbuf recycling (Pavel)

- Include address copy for zc send for POLLFIRST (Pavel)

- Fix for short IO handling in the normal read/write path (Pavel)

* tag 'io_uring-6.0-2022-09-09' of git://git.kernel.dk/linux-block:
io_uring/rw: fix short rw error handling
io_uring/net: copy addr for zc on POLL_FIRST
io_uring: recycle kbuf recycle on tw requeue
io_uring/kbuf: fix not advancing READV kbuf ring
io_uring/notif: Remove the unused function io_notif_complete()

+29 -25
+1
io_uring/io_uring.c
··· 1728 1728 1729 1729 switch (io_arm_poll_handler(req, 0)) { 1730 1730 case IO_APOLL_READY: 1731 + io_kbuf_recycle(req, 0); 1731 1732 io_req_task_queue(req); 1732 1733 break; 1733 1734 case IO_APOLL_ABORTED:
+6 -2
io_uring/kbuf.h
··· 91 91 * buffer data. However if that buffer is recycled the original request 92 92 * data stored in addr is lost. Therefore forbid recycling for now. 93 93 */ 94 - if (req->opcode == IORING_OP_READV) 94 + if (req->opcode == IORING_OP_READV) { 95 + if ((req->flags & REQ_F_BUFFER_RING) && req->buf_list) { 96 + req->buf_list->head++; 97 + req->buf_list = NULL; 98 + } 95 99 return; 96 - 100 + } 97 101 if (req->flags & REQ_F_BUFFER_SELECTED) 98 102 io_kbuf_recycle_legacy(req, issue_flags); 99 103 if (req->flags & REQ_F_BUFFER_RING)
+4 -3
io_uring/net.c
··· 1003 1003 unsigned msg_flags, cflags; 1004 1004 int ret, min_ret = 0; 1005 1005 1006 - if (!(req->flags & REQ_F_POLLED) && 1007 - (zc->flags & IORING_RECVSEND_POLL_FIRST)) 1008 - return -EAGAIN; 1009 1006 sock = sock_from_file(req->file); 1010 1007 if (unlikely(!sock)) 1011 1008 return -ENOTSOCK; ··· 1026 1029 } 1027 1030 msg.msg_namelen = zc->addr_len; 1028 1031 } 1032 + 1033 + if (!(req->flags & REQ_F_POLLED) && 1034 + (zc->flags & IORING_RECVSEND_POLL_FIRST)) 1035 + return io_setup_async_addr(req, addr, issue_flags); 1029 1036 1030 1037 if (zc->flags & IORING_RECVSEND_FIXED_BUF) { 1031 1038 ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
-8
io_uring/notif.c
··· 21 21 io_req_task_complete(notif, locked); 22 22 } 23 23 24 - static inline void io_notif_complete(struct io_kiocb *notif) 25 - __must_hold(&notif->ctx->uring_lock) 26 - { 27 - bool locked = true; 28 - 29 - __io_notif_complete_tw(notif, &locked); 30 - } 31 - 32 24 static void io_uring_tx_zerocopy_callback(struct sk_buff *skb, 33 25 struct ubuf_info *uarg, 34 26 bool success)
+18 -12
io_uring/rw.c
··· 206 206 return false; 207 207 } 208 208 209 + static inline unsigned io_fixup_rw_res(struct io_kiocb *req, unsigned res) 210 + { 211 + struct io_async_rw *io = req->async_data; 212 + 213 + /* add previously done IO, if any */ 214 + if (req_has_async_data(req) && io->bytes_done > 0) { 215 + if (res < 0) 216 + res = io->bytes_done; 217 + else 218 + res += io->bytes_done; 219 + } 220 + return res; 221 + } 222 + 209 223 static void io_complete_rw(struct kiocb *kiocb, long res) 210 224 { 211 225 struct io_rw *rw = container_of(kiocb, struct io_rw, kiocb); ··· 227 213 228 214 if (__io_complete_rw_common(req, res)) 229 215 return; 230 - io_req_set_res(req, res, 0); 216 + io_req_set_res(req, io_fixup_rw_res(req, res), 0); 231 217 req->io_task_work.func = io_req_task_complete; 232 218 io_req_task_work_add(req); 233 219 } ··· 254 240 static int kiocb_done(struct io_kiocb *req, ssize_t ret, 255 241 unsigned int issue_flags) 256 242 { 257 - struct io_async_rw *io = req->async_data; 258 243 struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); 259 - 260 - /* add previously done IO, if any */ 261 - if (req_has_async_data(req) && io->bytes_done > 0) { 262 - if (ret < 0) 263 - ret = io->bytes_done; 264 - else 265 - ret += io->bytes_done; 266 - } 244 + unsigned final_ret = io_fixup_rw_res(req, ret); 267 245 268 246 if (req->flags & REQ_F_CUR_POS) 269 247 req->file->f_pos = rw->kiocb.ki_pos; 270 248 if (ret >= 0 && (rw->kiocb.ki_complete == io_complete_rw)) { 271 249 if (!__io_complete_rw_common(req, ret)) { 272 - io_req_set_res(req, req->cqe.res, 250 + io_req_set_res(req, final_ret, 273 251 io_put_kbuf(req, issue_flags)); 274 252 return IOU_OK; 275 253 } ··· 274 268 if (io_resubmit_prep(req)) 275 269 io_req_task_queue_reissue(req); 276 270 else 277 - io_req_task_queue_fail(req, ret); 271 + io_req_task_queue_fail(req, final_ret); 278 272 } 279 273 return IOU_ISSUE_SKIP_COMPLETE; 280 274 }