summaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-03-10 09:54:25 -0700
committerJens Axboe <axboe@kernel.dk>2022-03-10 09:55:01 -0700
commit2be2eb02e2f5a096c351e5b70c46cfef259dabcd (patch)
tree2bce97d432297155f1a845169e2f5302108cbbe4 /fs/io_uring.c
parent9af177ee3ef14c17ef10893c257fa4e2008a3d74 (diff)
downloadlinux-2be2eb02e2f5a096c351e5b70c46cfef259dabcd.tar.bz2
io_uring: ensure reads re-import for selected buffers
If we drop buffers between scheduling a retry, then we need to re-import when we start the request again. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 4d8366bc226f..584b36dcd0aa 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3737,6 +3737,16 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags)
if (unlikely(ret < 0))
return ret;
} else {
+ /*
+ * Safe and required to re-import if we're using provided
+ * buffers, as we dropped the selected one before retry.
+ */
+ if (req->flags & REQ_F_BUFFER_SELECT) {
+ ret = io_import_iovec(READ, req, &iovec, s, issue_flags);
+ if (unlikely(ret < 0))
+ return ret;
+ }
+
rw = req->async_data;
s = &rw->s;
/*