diff --git a/fs/io_uring.c b/fs/io_uring.c index 2b0b9c3dda331..8b4213de9e085 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8738,6 +8738,14 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait) if (!io_sqring_full(ctx)) mask |= EPOLLOUT | EPOLLWRNORM; + /* prevent SQPOLL from submitting new requests */ + if (ctx->sq_data) { + io_sq_thread_park(ctx->sq_data); + list_del_init(&ctx->sqd_list); + io_sqd_update_thread_idle(ctx->sq_data); + io_sq_thread_unpark(ctx->sq_data); + } + /* * Don't flush cqring overflow list here, just do a simple check. * Otherwise there could possible be ABBA deadlock: @@ -8816,14 +8824,6 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) __io_cqring_overflow_flush(ctx, true, NULL, NULL); mutex_unlock(&ctx->uring_lock); - /* prevent SQPOLL from submitting new requests */ - if (ctx->sq_data) { - io_sq_thread_park(ctx->sq_data); - list_del_init(&ctx->sqd_list); - io_sqd_update_thread_idle(ctx->sq_data); - io_sq_thread_unpark(ctx->sq_data); - } - io_kill_timeouts(ctx, NULL, NULL); io_poll_remove_all(ctx, NULL, NULL);