]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd/mirror/snapshot: avoid UnlinkPeerRequest with a unlinked peer 40937/head
authorArthur Outhenin-Chalandre <arthur.outhenin-chalandre@cern.ch>
Tue, 20 Apr 2021 11:51:45 +0000 (13:51 +0200)
committerArthur Outhenin-Chalandre <arthur.outhenin-chalandre@cern.ch>
Tue, 4 May 2021 11:37:40 +0000 (13:37 +0200)
commitc6e2953fdb9e29cfb5fb4e04fd633862160cdb13
tree25b72faf79b3b2c6bc2d3199ac6d214e097c4a1f
parent477b705fe782668427bd11ab3fe9e350b9e72eac
librbd/mirror/snapshot: avoid UnlinkPeerRequest with a unlinked peer

CreatePrimaryRequest could create some UnlinkPeerRequest with an already
unlinked peer in a scenario where you have multiple peers. This request
will not remove the peer (as it's already not linked to the requested
peer) and will skip deletion of the mirror snapshot if another peer
remains. Eventually the code will go through an infinite recursive loop
between CreatePrimaryRequest and UnlinkPeerRequest and segfault.

This commit adds an extra condition to make sure to not submit a
UnlinkPeerRequest if the peer is not linked to the current snapshot. If
there is already no peer in the list it will submit a UnlinkPeerRequest
to remove the snapshot.

Fixes: https://tracker.ceph.com/issues/50439
Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@cern.ch>
src/librbd/mirror/snapshot/CreatePrimaryRequest.cc
src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc
src/test/librbd/test_mirroring.cc