Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pacific: mgr/rbd_support: fix recursive locking on CreateSnapshotRequests lock #54293

Merged
merged 2 commits into from Nov 8, 2023

Conversation

ajarr
Copy link
Contributor

@ajarr ajarr commented Nov 1, 2023

backport tracker: https://tracker.ceph.com/issues/63382


backport of #54251
parent tracker: https://tracker.ceph.com/issues/62994

this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/main/src/script/ceph-backport.sh

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 4452bc2)

 Conflicts:
	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
 - Above conflicts were due to commit e4a16e2
   ("mgr/rbd_support: add type annotation") not in pacific
There is no need for CreateSnapshotRequests.__del__() that calls
CreateSnapshotRequests.wait_for_pending().
MirrorSnapshotScheduleHandler.shutdown() already calls
CreateSnapshotRequests.wait_for_pending().

Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit fed1e87)

Conflicts:
       src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py
 - Above conflict was due to commit e4a16e2
   ("mgr/rbd_support: add type annotation") not in pacific
@batrick batrick modified the milestones: pacific, v16.2.15 Nov 8, 2023
@yuriw yuriw merged commit 65df424 into ceph:pacific Nov 8, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants