* [PATCH] io_uring/rw: ensure reissue path is correctly handled for IOPOLL
@ 2025-03-05 21:06 Jens Axboe
2025-03-06 10:12 ` John Garry
0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2025-03-05 21:06 UTC (permalink / raw)
To: io-uring; +Cc: John Garry
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.
Fixes: d803d123948f ("io_uring/rw: handle -EAGAIN retry at IO completion time")
Reported-by: John Garry <[email protected]>
Link: https://lore.kernel.org/io-uring/[email protected]/
Signed-off-by: Jens Axboe <[email protected]>
---
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 9edc6baebd01..e5528cebcd06 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -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 */
--
Jens Axboe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] io_uring/rw: ensure reissue path is correctly handled for IOPOLL
2025-03-05 21:06 [PATCH] io_uring/rw: ensure reissue path is correctly handled for IOPOLL Jens Axboe
@ 2025-03-06 10:12 ` John Garry
2025-03-06 11:33 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: John Garry @ 2025-03-06 10:12 UTC (permalink / raw)
To: Jens Axboe, io-uring
On 05/03/2025 21:06, Jens Axboe wrote:
> 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.
>
> 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]>
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] io_uring/rw: ensure reissue path is correctly handled for IOPOLL
2025-03-06 10:12 ` John Garry
@ 2025-03-06 11:33 ` Jens Axboe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-03-06 11:33 UTC (permalink / raw)
To: John Garry, io-uring
On 3/6/25 3:12 AM, John Garry wrote:
> On 05/03/2025 21:06, Jens Axboe wrote:
>> 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.
>>
>> 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!
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-06 11:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-05 21:06 [PATCH] io_uring/rw: ensure reissue path is correctly handled for IOPOLL Jens Axboe
2025-03-06 10:12 ` John Garry
2025-03-06 11:33 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox