From 7d33649cc0b6a887cb2e89e5ef2632e21529f4ec Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 10 Aug 2020 20:54:46 -0600 Subject: [PATCH] io_uring: notice short IO on completion path Async IO engines need to signal residual from the completion path, but we completely ignore those. Ensure we properly requeue IO that was short, after adjusting the state. Signed-off-by: Jens Axboe --- io_u.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/io_u.c b/io_u.c index 667530c0..63a42f9f 100644 --- a/io_u.c +++ b/io_u.c @@ -1977,6 +1977,21 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr, unsigned long long bytes = io_u->buflen - io_u->resid; int ret; + /* + * Make sure we notice short IO from here, and requeue them + * appropriately! + */ + if (io_u->resid) { + io_u->xfer_buflen = io_u->resid; + io_u->xfer_buf += bytes; + io_u->offset += bytes; + td->ts.short_io_u[io_u->ddir]++; + if (io_u->offset < io_u->file->real_file_size) { + requeue_io_u(td, io_u_ptr); + return; + } + } + td->io_blocks[ddir]++; td->io_bytes[ddir] += bytes; -- 2.25.1