Skip to content

Commit df6d342

Browse files
isilenceaxboe
authored andcommitted
io_uring/kbuf: fix not advancing READV kbuf ring
When we don't recycle a selected ring buffer we should advance the head of the ring, so don't just skip io_kbuf_recycle() for IORING_OP_READV but adjust the ring. Fixes: 934447a ("io_uring: do not recycle buffer in READV") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/a6d85e2611471bcb5d5dcd63a8342077ddc2d73d.1662480490.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 4fa07ed commit df6d342

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

io_uring/kbuf.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ static inline void io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
9191
* buffer data. However if that buffer is recycled the original request
9292
* data stored in addr is lost. Therefore forbid recycling for now.
9393
*/
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+
}
9599
return;
96-
100+
}
97101
if (req->flags & REQ_F_BUFFER_SELECTED)
98102
io_kbuf_recycle_legacy(req, issue_flags);
99103
if (req->flags & REQ_F_BUFFER_RING)

0 commit comments

Comments
 (0)