rw link fixes
cover rw link fixes
1/2 fixes an unexpected link breakage issue with reads. 2/2 makes pre-retry setup fails a bit nicer.
Pavel Begunkov (2):
io_uring/rw: fix unexpected link breakage io_uring/rw: don't lose short results on io_setup_async_rw()
io_uring/rw.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
2.37.2
PATCH 1/2 io_uring/rw: fix unexpected link breakage
req->cqe.res is set in io_read() to the amount of bytes left to be done, which is used to figure out whether to fail a read or not. However, io_read() may do another without returning, and we stash the previous value into ->bytes_done but forget to update cqe.res. Then we ask a read to do strictly less than cqe.res but expect the return to be exactly cqe.res.
Fix the bug by updating cqe.res for retries.
--- io_uring/rw.c | 1 + 1 file changed, 1 insertion(+)
io_uring/rw.c +1 -0
@@ -823,6 +823,7 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)return -EAGAIN ; } + req->cqe.res =iov_iter_count (&s->iter);/* * Now retry read with the IOCB_WAITQ parts set in the iocb. If * we get -EIOCBQUEUED, then we'll get a notification when the
Signature · 1 line
2.37.2
PATCH 2/2 io_uring/rw: don't lose short results on io_setup_async_rw()
In reply to Pavel BegunkovIf a retry io_setup_async_rw() fails we lose result from the first io_iter_do_read(), which is a problem mostly for streams/sockets.
--- io_uring/rw.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
io_uring/rw.c +5 -3
@@ -794,10 +794,12 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)iov_iter_restore (&s->iter, &s->iter_state); ret2 =io_setup_async_rw (req, iovec, s, true); -if (ret2) -return ret2; - iovec =NULL ; +if (ret2) { + ret = ret >0 ? ret : ret2; + goto done; + } + io = req->async_data; s = &io->s;/*
Signature · 1 line
2.37.2
Quoted 8 lines · Pavel Begunkov
1/2 fixes an unexpected link breakage issue with reads. 2/2 makes pre-retry setup fails a bit nicer.
Pavel Begunkov (2):
io_uring/rw: fix unexpected link breakageio_uring/rw: don't lose short results onio_setup_async_rw()[...]
Applied, thanks!
[1/2] io_uring/rw: fix unexpected link breakage
commit: 99562357ddaa4ec7f62e0cf68c13cbcde41e8e8e
[2/2] io_uring/rw: don't lose short results on io_setup_async_rw()
commit: 819c4df334438b7d47ccccb5549a8b862ef38e03Best regards,
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 8 lines · Jens Axboe
Quoted 7 lines · Pavel Begunkov
1/2 fixes an unexpected link breakage issue with reads. 2/2 makes pre-retry setup fails a bit nicer.
Pavel Begunkov (2):
io_uring/rw: fix unexpected link breakageio_uring/rw: don't lose short results onio_setup_async_rw()
Quoted 8 lines
Quoted 1 line
[...]
Applied, thanks!
[1/2]
io_uring/rw: fix unexpected link breakagecommit: 99562357ddaa4ec7f62e0cf68c13cbcde41e8e8e [2/2] io_uring/rw: don't lose short results on io_setup_async_rw() commit: 819c4df334438b7d47ccccb5549a8b862ef38e03
Oops, saw v2 after this. Dropped this series and took v2 instead to get the attributes.
Signature · 1 line
Jens Axboe