]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
mgr/rbd_support: fix recursive locking on CreateSnapshotRequests lock
authorRamana Raja <rraja@redhat.com>
Thu, 26 Oct 2023 17:18:52 +0000 (13:18 -0400)
committerRamana Raja <rraja@redhat.com>
Wed, 1 Nov 2023 10:52:24 +0000 (06:52 -0400)
commit734a26af5db695c2fe28fe572719484284d3ebb3
treececb60d9ed9eb8ef8815e490b45001fe97c7f17f
parentb2d97aaff5670ee64827a863ec038fc76e611047
mgr/rbd_support: fix recursive locking on CreateSnapshotRequests lock

The MirrorSnapshotScheduleHandler's run thread issues asynchronous
create snapshot requests using a CreateSnapshotRequests instance. When
the thread invokes a CreateSnapshotRequests instance's get_ioctx(),
the instance's class variable lock is acquired. With the class
variable lock held, the garbage collection of a CreateSnapshotRequests
instance may race in the thread. The thread would then call
CreateSnapshotRequests __del__() that tries to acquire the class
variable lock that the thread already holds. Fix this
recursive deadlock by converting the CreateSnapshotRequests lock from
a class variable to an instance variable. There is no need to share
the lock across CreateSnapshotRequests instances.

Also convert MirrorSnapshotScheduleHandler, PerfHandler and
TrashPurgeScheduleHandler class variables to instance variables
that don't need to be shared across the instances.

Fixes: https://tracker.ceph.com/issues/62994
Signed-off-by: Ramana Raja <rraja@redhat.com>
Co-Authored-By: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 4452bc22d1c6c8499cf55d6e39090adf7ae1dcbf)
src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py
src/pybind/mgr/rbd_support/perf.py
src/pybind/mgr/rbd_support/trash_purge_schedule.py