public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Marcelo Diop-Gonzalez <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: [PATCH] io_uring: flush timeouts that should already have expired
Date: Fri, 18 Dec 2020 16:46:24 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 18/12/2020 16:24, Marcelo Diop-Gonzalez wrote:
> Right now io_flush_timeouts() checks if the current number of events
> is equal to ->timeout.target_seq, but this will miss some timeouts if
> there have been more than 1 event added since the last time they were
> flushed (possible in io_submit_flush_completions(), for example). The
> test below hangs before this change (unless you run with
> $ ./a.out ~/somefile 1)
> 
[...]
> 
> Signed-off-by: Marcelo Diop-Gonzalez <[email protected]>
> ---
>  fs/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index b74957856e68..ae7244f8e842 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -1639,7 +1639,7 @@ static void io_flush_timeouts(struct io_ring_ctx *ctx)
>  
>  		if (io_is_timeout_noseq(req))
>  			break;
> -		if (req->timeout.target_seq != ctx->cached_cq_tail
> +		if (req->timeout.target_seq > ctx->cached_cq_tail

There was an pretty old patch for probably that problem, which got
lost... Please consider that target_seq and others are u32 and may
easily overflow, you can't do comparisons as freely. It would be
great to finally fix it, but that can be a bit harder to do.

>  					- atomic_read(&ctx->cq_timeouts))
>  			break;
>  
> 

-- 
Pavel Begunkov

  reply	other threads:[~2020-12-18 16:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 16:24 [PATCH] io_uring: flush timeouts that should already have expired Marcelo Diop-Gonzalez
2020-12-18 16:46 ` Pavel Begunkov [this message]
2020-12-18 17:04   ` Marcelo Diop-Gonzalez

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