summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-07-03 22:15:07 +0300
committerJens Axboe <axboe@kernel.dk>2020-07-05 15:07:37 -0600
commit652532ad459524d32c6bf1522e0b88d83b084d1a (patch)
treef45c0f29e0aa2e1bc5c62f621d6070b495481618 /fs/io_uring.c
parent6df1db6b542436c6d429caa66e1045862fa36155 (diff)
downloadlwn-652532ad459524d32c6bf1522e0b88d83b084d1a.tar.gz
lwn-652532ad459524d32c6bf1522e0b88d83b084d1a.zip
io_uring: keep queue_sqe()'s fail path separately
A preparation 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 <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index cf1b3d4ac241..7147e87a24b5 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5937,22 +5937,21 @@ punt:
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;