mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
io_uring/rsrc: add lockdep sanity checks
We should hold ->uring_lock while putting nodes with io_put_rsrc_node(), add a lockdep check for that. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/b50d5f156ac41450029796738c1dfd22a521df7a.1680576071.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
9eae8655f9
commit
1f2c8f610a
@ -1002,7 +1002,7 @@ static void __io_req_complete_post(struct io_kiocb *req, unsigned issue_flags)
|
||||
|
||||
if (rsrc_node) {
|
||||
io_ring_submit_lock(ctx, issue_flags);
|
||||
io_put_rsrc_node(rsrc_node);
|
||||
io_put_rsrc_node(ctx, rsrc_node);
|
||||
io_ring_submit_unlock(ctx, issue_flags);
|
||||
}
|
||||
}
|
||||
@ -1123,7 +1123,7 @@ static __cold void io_free_req_tw(struct io_kiocb *req, struct io_tw_state *ts)
|
||||
|
||||
if (req->rsrc_node) {
|
||||
io_tw_lock(ctx, ts);
|
||||
io_put_rsrc_node(req->rsrc_node);
|
||||
io_put_rsrc_node(ctx, req->rsrc_node);
|
||||
}
|
||||
io_dismantle_req(req);
|
||||
io_put_task_remote(req->task, 1);
|
||||
|
@ -236,7 +236,7 @@ void io_rsrc_node_switch(struct io_ring_ctx *ctx,
|
||||
|
||||
atomic_inc(&data_to_kill->refs);
|
||||
/* put master ref */
|
||||
io_put_rsrc_node(rsrc_node);
|
||||
io_put_rsrc_node(ctx, rsrc_node);
|
||||
ctx->rsrc_node = NULL;
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,10 @@ int io_register_rsrc_update(struct io_ring_ctx *ctx, void __user *arg,
|
||||
int io_register_rsrc(struct io_ring_ctx *ctx, void __user *arg,
|
||||
unsigned int size, unsigned int type);
|
||||
|
||||
static inline void io_put_rsrc_node(struct io_rsrc_node *node)
|
||||
static inline void io_put_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node)
|
||||
{
|
||||
lockdep_assert_held(&ctx->uring_lock);
|
||||
|
||||
if (node && !--node->refs)
|
||||
io_rsrc_node_ref_zero(node);
|
||||
}
|
||||
@ -128,7 +130,7 @@ static inline void io_put_rsrc_node(struct io_rsrc_node *node)
|
||||
static inline void io_req_put_rsrc_locked(struct io_kiocb *req,
|
||||
struct io_ring_ctx *ctx)
|
||||
{
|
||||
io_put_rsrc_node(req->rsrc_node);
|
||||
io_put_rsrc_node(ctx, req->rsrc_node);
|
||||
}
|
||||
|
||||
static inline void io_charge_rsrc_node(struct io_ring_ctx *ctx,
|
||||
|
Loading…
Reference in New Issue
Block a user