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 <asml.silence@xxxxxxxxx> > > Reported-by: Abaci <abaci@xxxxxxxxxxxxxxxxx> > Fixes: 6c503150ae33 ("io_uring: patch up IOPOLL overflow_flush sync") > Signed-off-by: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx> > --- > 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