From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>,
Xiaoguang Wang <[email protected]>,
[email protected]
Cc: [email protected]
Subject: Re: [PATCH] io_uring: don't issue reqs in iopoll mode when ctx is dying
Date: Wed, 24 Feb 2021 09:59:28 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 24/02/2021 09:46, Pavel Begunkov wrote:
>> Are you sure? We just don't want to reissue it, we need to fail it.
>> Hence if we catch it at reissue time, that should be enough. But I'm
>> open to clue batting :-)
>
> Jens, IOPOLL can happen from a different task, so
> 1) we don't want to grab io_wq_work context from it. As always we can pass it
> through task_work, or should be solved with your io-wq patches.
>
> 2) it happens who knows when in time, so iovec may be gone already -- same
> reasoning why io_[read,write]() copy it before going to io-wq.
The diff below should solve the second problem by failing them (not tested).
1) can be left to the io-wq patches.
diff --git a/fs/io_uring.c b/fs/io_uring.c
index bf9ad810c621..561c29b20463 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2610,8 +2610,11 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
list_del(&req->inflight_entry);
if (READ_ONCE(req->result) == -EAGAIN) {
+ bool reissue = req->async_data ||
+ !io_op_defs[req->opcode].needs_async_data;
+
req->iopoll_completed = 0;
- if (io_rw_reissue(req))
+ if (reissue && io_rw_reissue(req))
continue;
}
--
Pavel Begunkov
next prev parent reply other threads:[~2021-02-24 10:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-06 15:00 [PATCH] io_uring: don't issue reqs in iopoll mode when ctx is dying Xiaoguang Wang
2021-02-07 17:30 ` Pavel Begunkov
2021-02-08 2:50 ` Xiaoguang Wang
2021-02-08 13:35 ` Pavel Begunkov
2021-02-22 13:23 ` Pavel Begunkov
2021-02-24 2:30 ` Xiaoguang Wang
2021-02-24 2:35 ` Jens Axboe
2021-02-24 2:45 ` Xiaoguang Wang
2021-02-24 2:51 ` Jens Axboe
2021-02-24 9:46 ` Pavel Begunkov
2021-02-24 9:59 ` Pavel Begunkov [this message]
2021-02-24 10:33 ` Pavel Begunkov
2021-02-24 9:38 ` Pavel Begunkov
2021-02-24 12:42 ` Hao Xu
2021-02-25 10:55 ` Pavel Begunkov
2021-02-24 3:23 ` Xiaoguang Wang
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 \
[email protected] \
[email protected] \
[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