Skip to content

Commit 934447a

Browse files
Dylan Yudakenaxboe
authored andcommitted
io_uring: do not recycle buffer in READV
READV cannot recycle buffers as it would lose some of the data required to reimport that buffer. Reported-by: Ammar Faizi <[email protected]> Fixes: b66e65f ("io_uring: never call io_buffer_select() for a buffer re-select") Signed-off-by: Dylan Yudaken <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent ec8516f commit 934447a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/io_uring.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,14 @@ static void io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
17371737
(req->flags & REQ_F_PARTIAL_IO))
17381738
return;
17391739

1740+
/*
1741+
* READV uses fields in `struct io_rw` (len/addr) to stash the selected
1742+
* buffer data. However if that buffer is recycled the original request
1743+
* data stored in addr is lost. Therefore forbid recycling for now.
1744+
*/
1745+
if (req->opcode == IORING_OP_READV)
1746+
return;
1747+
17401748
/*
17411749
* We don't need to recycle for REQ_F_BUFFER_RING, we can just clear
17421750
* the flag and hence ensure that bl->head doesn't get incremented.

0 commit comments

Comments
 (0)