io_uring/rw: ensure reissue path is correctly handled for IOPOLL
Jens Axboe
maintainerPATCH 1/1 io_uring/rw: ensure reissue path is correctly handled for IOPOLL
The IOPOLL path posts CQEs when the io_kiocb is marked as completed, so it cannot rely on the usual retry that non-IOPOLL requests do for read/write requests.
If -EAGAIN is received and the request should be retried, go through the normal completion path and let the normal flush logic catch it and reissue it, like what is done for !IOPOLL reads or writes.
---
io_uring/rw.c +3 -4
@@ -560,11 +560,10 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res)if (kiocb->ki_flags &IOCB_WRITE )io_req_end_write (req);if (unlikely (res != req->cqe.res)) { -if (res == -EAGAIN &&io_rw_should_reissue (req)) { +if (res == -EAGAIN &&io_rw_should_reissue (req)) req->flags |=REQ_F_REISSUE |REQ_F_BL_NO_RECYCLE ; -return ; - } - req->cqe.res = res; +else + req->cqe.res = res; }/* order with io_iopoll_complete() checking ->iopoll_completed */
Signature · 1 line
Jens Axboe
Quoted 11 lines · Jens Axboe
The IOPOLL path posts CQEs when the
io_kiocbis marked as completed, so it cannot rely on the usual retry that non-IOPOLL requests do for read/write requests.If
-EAGAINis received and the request should be retried, go through the normal completion path and let the normal flush logic catch it and reissue it, like what is done for !IOPOLL reads or writes.Fixes d803d123948f ("io_uring/rw: handle -EAGAIN retry at IO completion time")Reported-by John Garry<[email protected]>Link https://urldefense.com/v3/__https://lore.kernel.org/io- uring/[email protected]/__;!! ACWV5N9M2RV99hQ!J4rCZomS7jntxigOWFGkQC3hFMb5EZf3-aZG4hZCB6n_quTKHse9g- WSxf46gMXpEfyzjaAQKTff2J9o0pg$ Signed-off-by: Jens Axboe<[email protected]>
This solves the issue which I was seeing, so:
cheers
Jens Axboe
maintainerQuoted 9 lines · John Garry
Quoted 8 lines · Jens Axboe
The IOPOLL path posts CQEs when the
io_kiocbis marked as completed, so it cannot rely on the usual retry that non-IOPOLL requests do for read/write requests.If
-EAGAINis received and the request should be retried, go through the normal completion path and let the normal flush logic catch it and reissue it, like what is done for !IOPOLL reads or writes.
Quoted 7 lines
Quoted 3 lines
Fixes d803d123948f ("io_uring/rw: handle -EAGAIN retry at IO completion time")Reported-by John Garry<[email protected]>Link https://urldefense.com/v3/__https://lore.kernel.org/io- uring/[email protected]/__;!! ACWV5N9M2RV99hQ!J4rCZomS7jntxigOWFGkQC3hFMb5EZf3-aZG4hZCB6n_quTKHse9g- WSxf46gMXpEfyzjaAQKTff2J9o0pg$ Signed-off-by: Jens Axboe<[email protected]>This solves the issue which I was seeing, so:
Tested-by John Garry <[email protected]>
Great, thanks for testing!
Signature · 1 line
Jens Axboe