Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/rsrc: Move lockdep assert from io_free_rsrc_node() to caller

Checking for lockdep_assert_held(&ctx->uring_lock) in io_free_rsrc_node()
means that the assertion is only checked when the resource drops to zero
references.
Move the lockdep assertion up into the caller io_put_rsrc_node() so that it
instead happens on every reference count decrement.

Signed-off-by: Jann Horn <jannh@google.com>
Link: https://lore.kernel.org/r/20250120-uring-lockdep-assert-earlier-v1-1-68d8e071a4bb@google.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Jann Horn and committed by
Jens Axboe
2839ab71 b73de0da

+3 -2
-2
io_uring/rsrc.c
··· 444 444 445 445 void io_free_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) 446 446 { 447 - lockdep_assert_held(&ctx->uring_lock); 448 - 449 447 if (node->tag) 450 448 io_post_aux_cqe(ctx, node->tag, 0, 0); 451 449
+3
io_uring/rsrc.h
··· 2 2 #ifndef IOU_RSRC_H 3 3 #define IOU_RSRC_H 4 4 5 + #include <linux/lockdep.h> 6 + 5 7 #define IO_NODE_ALLOC_CACHE_MAX 32 6 8 7 9 #define IO_RSRC_TAG_TABLE_SHIFT (PAGE_SHIFT - 3) ··· 82 80 83 81 static inline void io_put_rsrc_node(struct io_ring_ctx *ctx, struct io_rsrc_node *node) 84 82 { 83 + lockdep_assert_held(&ctx->uring_lock); 85 84 if (node && !--node->refs) 86 85 io_free_rsrc_node(ctx, node); 87 86 }