public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Hao Xu <[email protected]>, Jens Axboe <[email protected]>
Cc: [email protected], Joseph Qi <[email protected]>
Subject: Re: [PATCH RESEND RESEND] io_uring: fix flush cqring overflow list while TASK_INTERRUPTIBLE
Date: Wed, 27 Jan 2021 11:29:43 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 27/01/2021 07:14, Hao Xu wrote:
[...]
> This is caused by calling io_cqring_overflow_flush() which may sleep
> after calling prepare_to_wait_exclusive() which set task state to
> TASK_INTERRUPTIBLE

Looks good. The loop may use some refactoring for 5.12

Reviewed-by: Pavel Begunkov <[email protected]>

> 
> Reported-by: Abaci <[email protected]>
> Fixes: 6c503150ae33 ("io_uring: patch up IOPOLL overflow_flush sync")
> Signed-off-by: Hao Xu <[email protected]>
> ---
>  fs/io_uring.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index c07913ec0cca..3ca69a425182 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -7266,14 +7266,18 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
>  						TASK_INTERRUPTIBLE);
>  		/* make sure we run task_work before checking for signals */
>  		ret = io_run_task_work_sig();
> -		if (ret > 0)
> +		if (ret > 0) {
> +			finish_wait(&ctx->wait, &iowq.wq);
>  			continue;
> +		}
>  		else if (ret < 0)
>  			break;
>  		if (io_should_wake(&iowq))
>  			break;
> -		if (test_bit(0, &ctx->cq_check_overflow))
> +		if (test_bit(0, &ctx->cq_check_overflow)) {
> +			finish_wait(&ctx->wait, &iowq.wq);
>  			continue;
> +		}
>  		if (uts) {
>  			timeout = schedule_timeout(timeout);
>  			if (timeout == 0) {
> 

-- 
Pavel Begunkov

  reply	other threads:[~2021-01-27 11:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27  6:45 [PATCH] io_uring: fix flush cqring overflow list while TASK_INTERRUPTIBLE Hao Xu
2021-01-27  7:06 ` [PATCH RESEND] " Hao Xu
2021-01-27  7:14   ` [PATCH RESEND " Hao Xu
2021-01-27 11:29     ` Pavel Begunkov [this message]
2021-01-27 16:20     ` Jens Axboe

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] \
    [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