From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 2/3] io_uring: keep queue_sqe()'s fail path separately
Date: Fri, 3 Jul 2020 22:15:07 +0300 [thread overview]
Message-ID: <fb6d49f10b0e31d85be670dcde06dfd50face93c.1593803244.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
A preparataion path, extracts error path into a separate block.
It looks saner then calling req_set_fail_links() after
io_put_req_find_next(), even though it have been working well.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index f0fed59122e8..d61d8bc0cfc0 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5930,22 +5930,21 @@ static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
goto exit;
}
+ if (unlikely(ret)) {
err:
- /* drop submission reference */
- nxt = io_put_req_find_next(req);
-
- if (linked_timeout) {
- if (!ret)
- io_queue_linked_timeout(linked_timeout);
- else
- io_put_req(linked_timeout);
- }
-
- /* and drop final reference, if we failed */
- if (ret) {
+ /* un-prep timeout, so it'll be killed as any other linked */
+ req->flags &= ~REQ_F_LINK_TIMEOUT;
req_set_fail_links(req);
+ io_put_req(req);
io_req_complete(req, ret);
+ goto exit;
}
+
+ /* drop submission reference */
+ nxt = io_put_req_find_next(req);
+ if (linked_timeout)
+ io_queue_linked_timeout(linked_timeout);
+
if (nxt) {
req = nxt;
--
2.24.0
next prev parent reply other threads:[~2020-07-03 19:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-03 19:15 [PATCH 0/3] bunch of fixes Pavel Begunkov
2020-07-03 19:15 ` [PATCH 1/3] io_uring: fix mis-refcounting linked timeouts Pavel Begunkov
2020-07-03 19:15 ` Pavel Begunkov [this message]
2020-07-03 19:15 ` [PATCH 3/3] io_uring: fix lost cqe->flags Pavel Begunkov
2020-07-03 19:46 ` [PATCH 0/3] bunch of 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=fb6d49f10b0e31d85be670dcde06dfd50face93c.1593803244.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