]> git.apps.os.sepia.ceph.com Git - ceph.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>
Mon, 30 Oct 2023 16:01:14 +0000 (12:01 -0400)
commit4452bc22d1c6c8499cf55d6e39090adf7ae1dcbf
tree7ebaf2e5844bdddd9af17c10a69589634fe2af23
parentbf82a7bd34d6e65f817265743e0375d89ee403ea
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>
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