Re: [PATCH 2/2] io_uring: fix uring_flush in exit_files() warning

From: Pavel Begunkov
Date: Sat Jan 16 2021 - 21:49:22 EST


On 17/01/2021 02:31, Hillf Danton wrote:
> On Sat, 16 Jan 2021 05:32:30 +0000 Pavel Begunkov wrote:
>>
>> @@ -9126,7 +9126,10 @@ static int io_uring_flush(struct file *file, void *data)
>>
>> if (ctx->flags & IORING_SETUP_SQPOLL) {
>> /* there is only one file note, which is owned by sqo_task */
>> - WARN_ON_ONCE((ctx->sqo_task == current) ==
>> + WARN_ON_ONCE(ctx->sqo_task != current &&
>> + xa_load(&tctx->xa, (unsigned long)file));
>> + /* sqo_dead check is for when this happens after cancellation */
>> + WARN_ON_ONCE(ctx->sqo_task == current && !ctx->sqo_dead &&
>> !xa_load(&tctx->xa, (unsigned long)file));
>>
>> io_disable_sqo_submit(ctx);
>
> The added sqo_dead flag can not only quiesce a warning but save a
> disabling dryrun.

Don't think I get the sentence. Do you see any issue?

sqo_dead has a practical meaning, it prevents SQPOLL task from poking
into the creator task when it's racy. But yes, also in some cases makes
draining and killing rings nicer.

--
Pavel Begunkov