summaryrefslogtreecommitdiff
path: root/io_uring/rw.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-09-21 12:17:47 +0100
committerJens Axboe <axboe@kernel.dk>2022-09-21 13:15:02 -0600
commit47b4c68660752facfa6247b1fc9ca9d722b8b601 (patch)
treed578f234cdbfaa7722112d92b222e08ee9dc7b76 /io_uring/rw.c
parenta47b255e90395bdb481975ab3d9e96fcf8b3165f (diff)
downloadlinux-47b4c68660752facfa6247b1fc9ca9d722b8b601.tar.gz
io_uring/rw: don't lose partial IO result on fail
A partially done read/write may end up in io_req_complete_failed() and loose the result, make sure we return the number of bytes processed. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/05e0879c226bcd53b441bf92868eadd4bf04e2fc.1663668091.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/rw.c')
-rw-r--r--io_uring/rw.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c
index e50ba72091ac..59c92a4616b8 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -954,6 +954,14 @@ static void io_cqring_ev_posted_iopoll(struct io_ring_ctx *ctx)
io_cqring_wake(ctx);
}
+void io_rw_fail(struct io_kiocb *req)
+{
+ int res;
+
+ res = io_fixup_rw_res(req, req->cqe.res);
+ io_req_set_res(req, res, req->cqe.flags);
+}
+
int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
{
struct io_wq_work_node *pos, *start, *prev;