mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
io_uring: drop registered files and buffers at release time
Registered file and buffer tables are only torn down from io_ring_ctx_free(), which only runs when all requests have completed and the ctx refs have hit zero. Before this, every registered file remains open. The resource nodes are reference counted and any request using a registered file or buffer holds its own reference to the node, so this only releases what is actually unused. The rest follow as those requests complete or get canceled. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
89baa3154a
commit
66fe7abe9f
|
|
@ -2207,8 +2207,6 @@ static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx)
|
|||
io_sq_thread_finish(ctx);
|
||||
|
||||
mutex_lock(&ctx->uring_lock);
|
||||
io_sqe_buffers_unregister(ctx);
|
||||
io_sqe_files_unregister(ctx);
|
||||
io_unregister_zcrx(ctx);
|
||||
io_cqring_overflow_kill(ctx);
|
||||
io_eventfd_unregister(ctx);
|
||||
|
|
@ -2474,6 +2472,9 @@ static __cold void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
|
|||
xa_for_each(&ctx->personalities, index, creds)
|
||||
io_unregister_personality(ctx, index);
|
||||
io_terminate_zcrx(ctx);
|
||||
/* Drop these now, rather than async, to unpin the files */
|
||||
io_sqe_buffers_unregister(ctx);
|
||||
io_sqe_files_unregister(ctx);
|
||||
mutex_unlock(&ctx->uring_lock);
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user