io_uring: don't re-setup vecs/iter in io_resumit_prep() is already there

If we already have mapped the necessary data for retry, then don't set
it up again. It's a pointless operation, and we leak the iovec if it's
a large (non-stack) vec.

Fixes: b63534c41e ("io_uring: re-issue block requests that failed because of resources")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe 2020-09-14 09:28:14 -06:00
parent 6200b0ae4e
commit 8f3d749685

View File

@ -2294,13 +2294,17 @@ static bool io_resubmit_prep(struct io_kiocb *req, int error)
goto end_req; goto end_req;
} }
ret = io_import_iovec(rw, req, &iovec, &iter, false); if (!req->io) {
if (ret < 0) ret = io_import_iovec(rw, req, &iovec, &iter, false);
goto end_req; if (ret < 0)
ret = io_setup_async_rw(req, iovec, inline_vecs, &iter, false); goto end_req;
if (!ret) ret = io_setup_async_rw(req, iovec, inline_vecs, &iter, false);
if (!ret)
return true;
kfree(iovec);
} else {
return true; return true;
kfree(iovec); }
end_req: end_req:
req_set_fail_links(req); req_set_fail_links(req);
io_req_complete(req, ret); io_req_complete(req, ret);