]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix ctx-exit io_rsrc_put_work() deadlock
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 10 Aug 2021 01:44:23 +0000 (02:44 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 10 Aug 2021 01:59:28 +0000 (19:59 -0600)
commita10518eae17310c57e95b8be3ae9c683b89fb140
treea5d8303429c786df465bfe988bac84e266d4900c
parent93b23486edc800839cd2aac0c3793dac16265f5c
io_uring: fix ctx-exit io_rsrc_put_work() deadlock

__io_rsrc_put_work() might need ->uring_lock, so nobody should wait for
rsrc nodes holding the mutex. However, that's exactly what
io_ring_ctx_free() does with io_wait_rsrc_data().

Split it into rsrc wait + dealloc, and move the first one out of the
lock.

Cc: stable@vger.kernel.org
Fixes: 9e9c36484dccf ("io_uring: preparation for rsrc tagging")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/0130c5c2693468173ec1afab714e0885d2c9c363.1628559783.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c