]> Git Repo - J-linux.git/commitdiff
io_uring: do not recycle buffer in READV
authorDylan Yudaken <[email protected]>
Thu, 21 Jul 2022 13:13:25 +0000 (06:13 -0700)
committerJens Axboe <[email protected]>
Thu, 21 Jul 2022 14:31:31 +0000 (08:31 -0600)
READV cannot recycle buffers as it would lose some of the data required to
reimport that buffer.

Reported-by: Ammar Faizi <[email protected]>
Fixes: b66e65f41426 ("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]>
fs/io_uring.c

index 2b7bb62c7805c0fc763ac1d4393159773ae259ac..e8e769be9ed0581238efdbf223ff448922ba52c3 100644 (file)
@@ -1737,6 +1737,14 @@ static void io_kbuf_recycle(struct io_kiocb *req, unsigned issue_flags)
            (req->flags & REQ_F_PARTIAL_IO))
                return;
 
+       /*
+        * READV uses fields in `struct io_rw` (len/addr) to stash the selected
+        * buffer data. However if that buffer is recycled the original request
+        * data stored in addr is lost. Therefore forbid recycling for now.
+        */
+       if (req->opcode == IORING_OP_READV)
+               return;
+
        /*
         * We don't need to recycle for REQ_F_BUFFER_RING, we can just clear
         * the flag and hence ensure that bl->head doesn't get incremented.
This page took 0.069177 seconds and 4 git commands to generate.