From dd152e3614bd0f5ac76ee0b1bb834f54d8e3d0b0 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 12 Sep 2019 14:19:16 -0600 Subject: [PATCH 0645/2944] io_uring: make sqpoll wakeup possible with getevents commit b2a9eadab85730935f5a6fe19f3f61faaaced601 upstream. The way the logic is setup in io_uring_enter() means that you can't wake up the SQ poller thread while at the same time waiting (or polling) for completions afterwards. There's no reason for that to be the case. Reported-by: Lewis Baker Reviewed-by: Jeff Moyer Signed-off-by: Jens Axboe Signed-off-by: Joseph Qi Reviewed-by: Xiaoguang Wang --- fs/io_uring.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index ea61318..e55d4a1 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3356,15 +3356,12 @@ static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) * Just return the requested submit count, and wake the thread if * we were asked to. */ + ret = 0; if (ctx->flags & IORING_SETUP_SQPOLL) { if (flags & IORING_ENTER_SQ_WAKEUP) wake_up(&ctx->sqo_wait); submitted = to_submit; - goto out_ctx; - } - - ret = 0; - if (to_submit) { + } else if (to_submit) { bool block_for_last = false; to_submit = min(to_submit, ctx->sq_entries); @@ -3394,7 +3391,6 @@ static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) } } -out_ctx: io_ring_drop_ctx_refs(ctx, 1); out_fput: fdput(f); -- 1.8.3.1