summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3cce2dbb30dc..aab3a52ddf50 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1829,11 +1829,16 @@ static void io_dismantle_req(struct io_kiocb *req)
static void __io_free_req(struct io_kiocb *req)
{
struct io_ring_ctx *ctx = req->ctx;
+ unsigned long flags;
io_dismantle_req(req);
io_put_task(req->task, 1);
- kmem_cache_free(req_cachep, req);
+ spin_lock_irqsave(&ctx->completion_lock, flags);
+ list_add(&req->compl.list, &ctx->locked_free_list);
+ ctx->locked_free_nr++;
+ spin_unlock_irqrestore(&ctx->completion_lock, flags);
+
percpu_ref_put(&ctx->refs);
}