Commit 6436c770 authored by Jens Axboe's avatar Jens Axboe

io_uring: recycle provided buffer if we punt to io-wq

io_arm_poll_handler() will recycle the buffer appropriately if we end
up arming poll (or if we're ready to retry), but not for the io-wq case
if we have attempted poll first.

Explicitly recycle the buffer to avoid both hanging on to it too long,
but also to avoid multiple reads grabbing the same one. This can happen
for ring mapped buffers, since it hasn't necessarily been committed.

Fixes: c7fb1942 ("io_uring: add support for ring mapped supplied buffers")
Link: https://github.com/axboe/liburing/issues/605Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 32fc810b
...@@ -8690,6 +8690,7 @@ static void io_queue_async(struct io_kiocb *req, int ret) ...@@ -8690,6 +8690,7 @@ static void io_queue_async(struct io_kiocb *req, int ret)
* Queued up for async execution, worker will release * Queued up for async execution, worker will release
* submit reference when the iocb is actually submitted. * submit reference when the iocb is actually submitted.
*/ */
io_kbuf_recycle(req, 0);
io_queue_iowq(req, NULL); io_queue_iowq(req, NULL);
break; break;
case IO_APOLL_OK: case IO_APOLL_OK:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment