Re: [PATCH] io_uring: don't submit sqes when ctx->refs is dying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <haoxu@xxxxxxxxxxxxxxxxx>
> ---
>  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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux