]> www.infradead.org Git - users/hch/misc.git/commit
io_uring/rsrc: Simplify buffer cloning by locking both rings
authorJann Horn <jannh@google.com>
Wed, 15 Jan 2025 20:26:03 +0000 (21:26 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Jan 2025 14:07:10 +0000 (07:07 -0700)
commit5719e2823565a304a2afb752d4792c622a693e22
tree4d9c69ab6d63a765bd70f8201d3fccc847e7741a
parent95ec54a420b8f445e04a7ca0ea8deb72c51fe1d3
io_uring/rsrc: Simplify buffer cloning by locking both rings

The locking in the buffer cloning code is somewhat complex because it goes
back and forth between locking the source ring and the destination ring.

Make it easier to reason about by locking both rings at the same time.
To avoid ABBA deadlocks, lock the rings in ascending kernel address order,
just like in lock_two_nondirectories().

Signed-off-by: Jann Horn <jannh@google.com>
Link: https://lore.kernel.org/r/20250115-uring-clone-refactor-v2-1-7289ba50776d@google.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/rsrc.c