Skip to content

Commit 7b53d59

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix overflowed reqs cancellation
Overflowed requests in io_uring_cancel_files() should be shed only of inflight and overflowed refs. All other left references are owned by someone else. If refcount_sub_and_test() fails, it will go further and put put extra ref, don't do that. Also, don't need to do io_wq_cancel_work() for overflowed reqs, they will be let go shortly anyway. Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent bfe68a2 commit 7b53d59

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/io_uring.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7449,10 +7449,11 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx,
74497449
finish_wait(&ctx->inflight_wait, &wait);
74507450
continue;
74517451
}
7452+
} else {
7453+
io_wq_cancel_work(ctx->io_wq, &cancel_req->work);
7454+
io_put_req(cancel_req);
74527455
}
74537456

7454-
io_wq_cancel_work(ctx->io_wq, &cancel_req->work);
7455-
io_put_req(cancel_req);
74567457
schedule();
74577458
finish_wait(&ctx->inflight_wait, &wait);
74587459
}

0 commit comments

Comments
 (0)