Skip to content

Commit

Permalink
io_uring: don't re-setup vecs/iter in io_resumit_prep() is already there
Browse files Browse the repository at this point in the history
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: b63534c ("io_uring: re-issue block requests that failed because of resources")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Sep 21, 2020
1 parent 6200b0a commit 8f3d749
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -2294,13 +2294,17 @@ static bool io_resubmit_prep(struct io_kiocb *req, int error)
goto end_req;
}

ret = io_import_iovec(rw, req, &iovec, &iter, false);
if (ret < 0)
goto end_req;
ret = io_setup_async_rw(req, iovec, inline_vecs, &iter, false);
if (!ret)
if (!req->io) {
ret = io_import_iovec(rw, req, &iovec, &iter, false);
if (ret < 0)
goto end_req;
ret = io_setup_async_rw(req, iovec, inline_vecs, &iter, false);
if (!ret)
return true;
kfree(iovec);
} else {
return true;
kfree(iovec);
}
end_req:
req_set_fail_links(req);
io_req_complete(req, ret);
Expand Down

0 comments on commit 8f3d749

Please sign in to comment.