public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>,
	[email protected], [email protected]
Subject: [PATCH 1/4] io_uring: fix hanging iopoll in case of -EAGAIN
Date: Tue, 23 Jun 2020 01:16:32 +0300	[thread overview]
Message-ID: <0301f35644823a01cbae87e440df7d58ebcf2279.1592863245.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

io_do_iopoll() won't do anything with a request unless
req->iopoll_completed is set. So io_complete_rw_iopoll() has to set
it, otherwise io_do_iopoll() will poll a file again and again even
though the request of interest was completed long ago.

Fixes: bbde017a32b3 ("io_uring: add memory barrier to synchronize
io_kiocb's result and iopoll_completed")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index c686061c3762..bb0dfc450db5 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2104,10 +2104,8 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
 
 	WRITE_ONCE(req->result, res);
 	/* order with io_poll_complete() checking ->result */
-	if (res != -EAGAIN) {
-		smp_wmb();
-		WRITE_ONCE(req->iopoll_completed, 1);
-	}
+	smp_wmb();
+	WRITE_ONCE(req->iopoll_completed, 1);
 }
 
 /*
-- 
2.24.0


  reply	other threads:[~2020-06-22 22:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 22:16 [PATCH 0/4] iopoll fixes + cleanups Pavel Begunkov
2020-06-22 22:16 ` Pavel Begunkov [this message]
2020-06-23  2:07   ` [PATCH 1/4] io_uring: fix hanging iopoll in case of -EAGAIN Jens Axboe
2020-06-23  2:18     ` Jens Axboe
2020-06-23 11:57       ` Pavel Begunkov
2020-06-23 19:01         ` Jens Axboe
2020-06-24 16:56           ` Pavel Begunkov
2020-06-22 22:16 ` [PATCH 2/4] io_uring: handle EAGAIN iopoll Pavel Begunkov
2020-06-30  4:01   ` kernel test robot
2020-06-22 22:16 ` [PATCH 3/4] io-wq: compact io-wq flags numbers Pavel Begunkov
2020-06-22 22:16 ` [PATCH 4/4] io-wq: return next work from ->do_work() directly Pavel Begunkov

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=0301f35644823a01cbae87e440df7d58ebcf2279.1592863245.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