]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: fix recursive locking on owner_lock in ImageDispatch
authorIlya Dryomov <idryomov@gmail.com>
Tue, 28 Mar 2023 17:52:42 +0000 (19:52 +0200)
committerChristopher Hoffman <choffman@redhat.com>
Thu, 6 Apr 2023 15:21:51 +0000 (15:21 +0000)
commitdd44afbe47319716f9e17e61e306d000f299acdd
tree609d1b5f4373c34ef7f5559c31cf0641e1382c4b
parent73f0026f89761f925ef65c3748cee77d2678abc7
librbd: fix recursive locking on owner_lock in ImageDispatch

needs_exclusive_lock() calls acquire_lock() with owner_lock held.
If lock acquisiton races with lock shut down, ManagedLock completes
ImageDispatch context directly and dispatch is retried immediately on
the same thread (due to DISPATCH_RESULT_RESTART).  This results in
recursion into needs_exclusive_lock() and, barring locking issues, can
lead to unbounded stack growth if lock shut down takes its time.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 1d943f8c47b3510e47d40701e9acd213706754e5)
src/librbd/exclusive_lock/ImageDispatch.cc