public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: Beld Zhang <[email protected]>
Subject: Re: [PATCH 5.15] io_uring: fix ltimeout unprep
Date: Wed, 20 Oct 2021 09:45:02 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 10/20/21 09:33, Pavel Begunkov wrote:
> On 10/20/21 02:48, Jens Axboe wrote:
>> On 10/19/21 7:26 PM, Pavel Begunkov wrote:
>>> io_unprep_linked_timeout() is broken, first it needs to return back
>>> REQ_F_ARM_LTIMEOUT, so the linked timeout is enqueued and disarmed. But
>>> now we refcounted it, and linked timeouts may get not executed at all,
>>> leaking a request.
>>>
>>> Just kill the unprep optimisation.
>>
>> This appears to be against something that is not 5.15, can you please
>> check the end result:
> 
> Yeah, it was 5.16 for some reason. Looks good, thanks!

Actually, it's not. We need either unprep but "smarter" or queue the
timeout. I'll send a v2 for convenience, but a fold in is below.

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 36db7b76cf8d..d5cc103224f1 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6979,6 +6979,8 @@ static void __io_queue_sqe(struct io_kiocb *req)
  
  		switch (io_arm_poll_handler(req)) {
  		case IO_APOLL_READY:
+			if (linked_timeout)
+				io_queue_linked_timeout(linked_timeout);
  			goto issue_sqe;
  		case IO_APOLL_ABORTED:
  			/*


-- 
Pavel Begunkov

      reply	other threads:[~2021-10-20  8:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20  1:26 [PATCH 5.15] io_uring: fix ltimeout unprep Pavel Begunkov
2021-10-20  1:48 ` Jens Axboe
2021-10-20  8:33   ` Pavel Begunkov
2021-10-20  8:45     ` Pavel Begunkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox