diff --git a/fs/io_uring.c b/fs/io_uring.c index 472bcea45bc88333b71ae9a1f70c593d8c282459..a879bf98588345596e789752816d21b071083e37 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2102,9 +2102,7 @@ static void io_req_task_cancel(struct callback_head *cb) struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work); struct io_ring_ctx *ctx = req->ctx; - mutex_lock(&ctx->uring_lock); __io_req_task_cancel(req, -ECANCELED); - mutex_unlock(&ctx->uring_lock); percpu_ref_put(&ctx->refs); } @@ -6127,11 +6125,7 @@ static struct io_wq_work *io_wq_submit_work(struct io_wq_work *work) /* if NO_CANCEL is set, we must still run the work */ if ((work->flags & (IO_WQ_WORK_CANCEL|IO_WQ_WORK_NO_CANCEL)) == IO_WQ_WORK_CANCEL) { - /* io-wq is going to take down one */ - refcount_inc(&req->refs); - percpu_ref_get(&req->ctx->refs); - io_req_task_work_add_fallback(req, io_req_task_cancel); - return io_steal_work(req); + ret = -ECANCELED; } if (!ret) {