Skip to content

Commit 2a44f46

Browse files
committed
io_uring: pick up link work on submit reference drop
If work completes inline, then we should pick up a dependent link item in __io_queue_sqe() as well. If we don't do so, we're forced to go async with that item, which is suboptimal. This also fixes an issue with io_put_req_find_next(), which always looks up the next work item. That should only be done if we're dropping the last reference to the request, to prevent multiple lookups of the same work item. Outside of being a fix, this also enables a good cleanup series for 5.7, where we never have to pass 'nxt' around or into the work handlers. Reviewed-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 2d141dd commit 2a44f46

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/io_uring.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,10 +1483,10 @@ static void io_free_req(struct io_kiocb *req)
14831483
__attribute__((nonnull))
14841484
static void io_put_req_find_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
14851485
{
1486-
io_req_find_next(req, nxtptr);
1487-
1488-
if (refcount_dec_and_test(&req->refs))
1486+
if (refcount_dec_and_test(&req->refs)) {
1487+
io_req_find_next(req, nxtptr);
14891488
__io_free_req(req);
1489+
}
14901490
}
14911491

14921492
static void io_put_req(struct io_kiocb *req)
@@ -4749,7 +4749,7 @@ static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe)
47494749

47504750
err:
47514751
/* drop submission reference */
4752-
io_put_req(req);
4752+
io_put_req_find_next(req, &nxt);
47534753

47544754
if (linked_timeout) {
47554755
if (!ret)

0 commit comments

Comments
 (0)