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] io_uring: don't submit sqes when ctx->refs is dying
Date: Fri, 19 Feb 2021 18:04:47 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 19/02/2021 17:58, Hao Xu wrote:
> When doing __io_uring_register() and waiting for references to exit,
> there could be other threads calling io_uring_enter() and submitting
> sqes which may cause the drain wait endless. So avoid this case by
> checking if ctx->refs is dying.

IMHO, let's leave it as is because it noticeably changes behaviour.
That's nothing that can't be solved in userspace if needed differently.

> 
> Signed-off-by: Hao Xu <[email protected]>
> ---
>  fs/io_uring.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 931671082e61..9aab4d25c2df 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -9356,6 +9356,8 @@ static int io_get_ext_arg(unsigned flags, const void __user *argp, size_t *argsz
>  		}
>  		submitted = to_submit;
>  	} else if (to_submit) {
> +		if (unlikely(percpu_ref_is_dying(&ctx->refs)))
> +			goto out;
>  		ret = io_uring_add_task_file(ctx, f.file);
>  		if (unlikely(ret))
>  			goto out;
> 

-- 
Pavel Begunkov

      reply	other threads:[~2021-02-19 18:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 17:58 [PATCH] io_uring: don't submit sqes when ctx->refs is dying Hao Xu
2021-02-19 18:04 ` 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] \
    [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