Skip to content

Commit 48bdd84

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix ctx refcounting in io_submit_sqes()
If io_get_req() fails, it drops a ref. Then, awhile keeping @submitted unmodified, io_submit_sqes() breaks the loop and puts @nr - @submitted refs. For each submitted req a ref is dropped in io_put_req() and friends. So, for @nr taken refs there will be (@nr - @submitted + @submitted + 1) dropped. Remove ctx refcounting from io_get_req(), that at the same time makes it clearer. Fixes: 2b85edf ("io_uring: batch getting pcpu references") Cc: [email protected] # v5.6 Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 581f981 commit 48bdd84

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

fs/io_uring.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,6 @@ static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx,
13421342
req = io_get_fallback_req(ctx);
13431343
if (req)
13441344
goto got_it;
1345-
percpu_ref_put(&ctx->refs);
13461345
return NULL;
13471346
}
13481347

0 commit comments

Comments
 (0)