ctx->inflight_lock now doesn't protect anything that should be protected -- tctx->inflight_files is atomic, and inflight list is gone. Time to eradicate it. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 134ea0e3373d..a678920b1c8d 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -377,8 +377,6 @@ struct io_ring_ctx { struct hlist_head *cancel_hash; unsigned cancel_hash_bits; bool poll_multi_file; - - spinlock_t inflight_lock; } ____cacheline_aligned_in_smp; struct delayed_work file_put_work; @@ -1303,7 +1301,6 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) INIT_LIST_HEAD(&ctx->iopoll_list); INIT_LIST_HEAD(&ctx->defer_list); INIT_LIST_HEAD(&ctx->timeout_list); - spin_lock_init(&ctx->inflight_lock); INIT_DELAYED_WORK(&ctx->file_put_work, io_file_put_work); init_llist_head(&ctx->file_put_llist); return ctx; @@ -1433,7 +1430,6 @@ static bool io_grab_identity(struct io_kiocb *req) { const struct io_op_def *def = &io_op_defs[req->opcode]; struct io_identity *id = req->work.identity; - struct io_ring_ctx *ctx = req->ctx; if (def->work_flags & IO_WQ_WORK_FSIZE) { if (id->fsize != rlimit(RLIMIT_FSIZE)) @@ -1491,9 +1487,7 @@ static bool io_grab_identity(struct io_kiocb *req) get_nsproxy(id->nsproxy); req->flags |= REQ_F_INFLIGHT; - spin_lock_irq(&ctx->inflight_lock); atomic_inc(¤t->io_uring->inflight_files); - spin_unlock_irq(&ctx->inflight_lock); req->work.flags |= IO_WQ_WORK_FILES; } @@ -6088,15 +6082,11 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe) static void io_req_drop_files(struct io_kiocb *req) { - struct io_ring_ctx *ctx = req->ctx; struct io_uring_task *tctx = req->task->io_uring; - unsigned long flags; put_files_struct(req->work.identity->files); put_nsproxy(req->work.identity->nsproxy); - spin_lock_irqsave(&ctx->inflight_lock, flags); atomic_dec(&tctx->inflight_files); - spin_unlock_irqrestore(&ctx->inflight_lock, flags); req->flags &= ~REQ_F_INFLIGHT; req->work.flags &= ~IO_WQ_WORK_FILES; if (atomic_read(&tctx->in_idle)) -- 2.24.0