public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: [email protected]
Subject: [PATCH] io_uring: fix invalid handler for double apoll
Date: Sun, 25 Oct 2020 14:26:52 +0000	[thread overview]
Message-ID: <1bf1093730a68f8939bfd7e6747add7af37ad321.1603635991.git.asml.silence@gmail.com> (raw)

io_poll_double_wake() is called for both: poll requests and as apoll
(internal poll to make rw and other requests), hence when it calls
__io_async_wake() it should use a right callback depending on the
current poll type.

Cc: [email protected] # v5.8+
Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 20781e939940..b2d72bd18fcf 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4927,6 +4927,8 @@ static void io_poll_task_func(struct callback_head *cb)
 	percpu_ref_put(&ctx->refs);
 }
 
+static void io_async_task_func(struct callback_head *cb);
+
 static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode,
 			       int sync, void *key)
 {
@@ -4950,8 +4952,12 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode,
 		/* make sure double remove sees this as being gone */
 		wait->private = NULL;
 		spin_unlock(&poll->head->lock);
-		if (!done)
-			__io_async_wake(req, poll, mask, io_poll_task_func);
+		if (!done) {
+			if (req->opcode == IORING_OP_POLL_ADD)
+				__io_async_wake(req, poll, mask, io_poll_task_func);
+			else
+				__io_async_wake(req, poll, mask, io_async_task_func);
+		}
 	}
 	refcount_dec(&req->refs);
 	return 1;
-- 
2.24.0


             reply	other threads:[~2020-10-25 14:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-25 14:26 Pavel Begunkov [this message]
2020-10-25 15:53 ` [PATCH] io_uring: fix invalid handler for double apoll Jens Axboe
2020-10-25 16:24   ` Pavel Begunkov
2020-10-25 18:42     ` Jens Axboe
2020-10-25 19:01       ` Pavel Begunkov
2020-10-25 19:18         ` Jens Axboe
2020-10-25 19:32           ` Pavel Begunkov
2020-10-25 19:44             ` Jens Axboe
2020-10-25 19:54               ` Pavel Begunkov
2020-10-26  1:22                 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bf1093730a68f8939bfd7e6747add7af37ad321.1603635991.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox