From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 2/4] io_uring: fix rw req completion
Date: Thu, 8 Apr 2021 01:54:40 +0100 [thread overview]
Message-ID: <f602250d292f8a84cca9a01d747744d1e797be26.1617842918.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
WARNING: at fs/io_uring.c:8578 io_ring_exit_work.cold+0x0/0x18
As reissuing is now passed back by REQ_F_REISSUE, kiocb_done() may just
set the flag and do nothing leaving dangling requests. The handling is a
bit fragile, e.g. can't just complete them because the case of reading
beyond file boundary needs blocking context to return 0, otherwise it
may be -EAGAIN.
Go the easy way for now, just emulate how it was by io_rw_reissue() in
kiocb_done()
Fixes: 230d50d448ac ("io_uring: move reissue into regular IO path")
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index f1881ac0744b..de5822350345 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2762,6 +2762,7 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret,
{
struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
struct io_async_rw *io = req->async_data;
+ bool check_reissue = (kiocb->ki_complete == io_complete_rw);
/* add previously done IO, if any */
if (io && io->bytes_done > 0) {
@@ -2777,6 +2778,11 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret,
__io_complete_rw(req, ret, 0, issue_flags);
else
io_rw_done(kiocb, ret);
+
+ if (check_reissue && req->flags & REQ_F_REISSUE) {
+ req->flags &= ~REQ_F_REISSUE;
+ io_rw_reissue(req);
+ }
}
static int io_import_fixed(struct io_kiocb *req, int rw, struct iov_iter *iter)
--
2.24.0
next prev parent reply other threads:[~2021-04-08 0:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 0:54 [PATCH 5.12 0/4] 5.12 fixes Pavel Begunkov
2021-04-08 0:54 ` [PATCH 1/4] io_uring: clear F_REISSUE right after getting it Pavel Begunkov
2021-04-08 0:54 ` Pavel Begunkov [this message]
2021-04-08 0:54 ` [PATCH 3/4] io_uring: fix poll_rewait racing for ->canceled Pavel Begunkov
2021-04-08 2:28 ` Pavel Begunkov
2021-04-08 0:54 ` [PATCH 4/4] io-wq: cancel unbounded works on io-wq destroy Pavel Begunkov
2021-04-08 4:11 ` [PATCH 5.12 0/4] 5.12 fixes 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=f602250d292f8a84cca9a01d747744d1e797be26.1617842918.git.asml.silence@gmail.com \
[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