diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2023-04-04 14:39:55 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-04-04 17:30:39 +0200 |
commit | 1f2c8f610aa6c6a3dc3523f93eaf28c25051df6f (patch) | |
tree | f75b8a937ad5d567951ac042bc1b5b327c6859b7 /io_uring/rsrc.h | |
parent | io_uring/rsrc: cache struct io_rsrc_node (diff) | |
download | linux-1f2c8f610aa6c6a3dc3523f93eaf28c25051df6f.tar.xz linux-1f2c8f610aa6c6a3dc3523f93eaf28c25051df6f.zip |
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>
Diffstat (limited to '')
-rw-r--r-- | io_uring/rsrc.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h index 3b9f4c57c47c..cf24c3fd701f 100644 --- a/io_uring/rsrc.h +++ b/io_uring/rsrc.h @@ -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, |