public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring/timeout: fix multishot updates
@ 2025-01-04 18:29 Pavel Begunkov
  2025-01-04 18:39 ` Jens Axboe
  2025-01-04 18:40 ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Pavel Begunkov @ 2025-01-04 18:29 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence, Christian Mazakas

After update only the first shot of a multishot timeout request adheres
to the new timeout value while all subsequent retries continue to use
the old value. Don't forget to update the timeout stored in struct
io_timeout_data.

Cc: [email protected]
Fixes: ea97f6c8558e8 ("io_uring: add support for multishot timeouts")
Reported-by: Christian Mazakas <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/timeout.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/io_uring/timeout.c b/io_uring/timeout.c
index f55e25338b23..dd719e3ca870 100644
--- a/io_uring/timeout.c
+++ b/io_uring/timeout.c
@@ -410,10 +410,12 @@ static int io_timeout_update(struct io_ring_ctx *ctx, __u64 user_data,
 
 	timeout->off = 0; /* noseq */
 	data = req->async_data;
+	data->ts = *ts;
+
 	list_add_tail(&timeout->list, &ctx->timeout_list);
 	hrtimer_init(&data->timer, io_timeout_get_clock(data), mode);
 	data->timer.function = io_timeout_fn;
-	hrtimer_start(&data->timer, timespec64_to_ktime(*ts), mode);
+	hrtimer_start(&data->timer, timespec64_to_ktime(data->ts), mode);
 	return 0;
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring/timeout: fix multishot updates
  2025-01-04 18:29 [PATCH 1/1] io_uring/timeout: fix multishot updates Pavel Begunkov
@ 2025-01-04 18:39 ` Jens Axboe
  2025-01-04 20:44   ` Pavel Begunkov
  2025-01-04 18:40 ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2025-01-04 18:39 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring; +Cc: Christian Mazakas

On 1/4/25 11:29 AM, Pavel Begunkov wrote:
> After update only the first shot of a multishot timeout request adheres
> to the new timeout value while all subsequent retries continue to use
> the old value. Don't forget to update the timeout stored in struct
> io_timeout_data.

Nice find!

Do we have a test case that can go into liburing for this too?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring/timeout: fix multishot updates
  2025-01-04 18:29 [PATCH 1/1] io_uring/timeout: fix multishot updates Pavel Begunkov
  2025-01-04 18:39 ` Jens Axboe
@ 2025-01-04 18:40 ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-01-04 18:40 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov; +Cc: Christian Mazakas


On Sat, 04 Jan 2025 18:29:02 +0000, Pavel Begunkov wrote:
> After update only the first shot of a multishot timeout request adheres
> to the new timeout value while all subsequent retries continue to use
> the old value. Don't forget to update the timeout stored in struct
> io_timeout_data.
> 
> 

Applied, thanks!

[1/1] io_uring/timeout: fix multishot updates
      commit: c83c846231db8b153bfcb44d552d373c34f78245

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring/timeout: fix multishot updates
  2025-01-04 18:39 ` Jens Axboe
@ 2025-01-04 20:44   ` Pavel Begunkov
  2025-01-04 22:12     ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Begunkov @ 2025-01-04 20:44 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: Christian Mazakas

On 1/4/25 18:39, Jens Axboe wrote:
> On 1/4/25 11:29 AM, Pavel Begunkov wrote:
>> After update only the first shot of a multishot timeout request adheres
>> to the new timeout value while all subsequent retries continue to use
>> the old value. Don't forget to update the timeout stored in struct
>> io_timeout_data.
> 
> Nice find!
> 
> Do we have a test case that can go into liburing for this too?

Christian has a patch, I assume he's going to send it

https://github.com/axboe/liburing/issues/1316
https://github.com/axboe/liburing/commit/3a5919aef666bdf0202c76918dbb85f1a6db9a32

-- 
Pavel Begunkov


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring/timeout: fix multishot updates
  2025-01-04 20:44   ` Pavel Begunkov
@ 2025-01-04 22:12     ` Jens Axboe
  0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-01-04 22:12 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring; +Cc: Christian Mazakas

On 1/4/25 1:44 PM, Pavel Begunkov wrote:
> On 1/4/25 18:39, Jens Axboe wrote:
>> On 1/4/25 11:29 AM, Pavel Begunkov wrote:
>>> After update only the first shot of a multishot timeout request adheres
>>> to the new timeout value while all subsequent retries continue to use
>>> the old value. Don't forget to update the timeout stored in struct
>>> io_timeout_data.
>>
>> Nice find!
>>
>> Do we have a test case that can go into liburing for this too?
> 
> Christian has a patch, I assume he's going to send it
> 
> https://github.com/axboe/liburing/issues/1316
> https://github.com/axboe/liburing/commit/3a5919aef666bdf0202c76918dbb85f1a6db9a32

Perfect.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-01-04 22:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-04 18:29 [PATCH 1/1] io_uring/timeout: fix multishot updates Pavel Begunkov
2025-01-04 18:39 ` Jens Axboe
2025-01-04 20:44   ` Pavel Begunkov
2025-01-04 22:12     ` Jens Axboe
2025-01-04 18:40 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox