]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd/mirror/snapshot: avoid UnlinkPeerRequest with a unlinked peer 41304/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>
Wed, 12 May 2021 12:31:00 +0000 (14:31 +0200)
commit26c69da34ce2f9d149575e83526d9f00c5379c9d
tree35e28779ead0528f9aa85ddd7e2ffb1cd1e01896
parentfcccc2f27eaf9355aaf547716f17d1fee06ae832
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>
(cherry picked from commit c6e2953fdb9e29cfb5fb4e04fd633862160cdb13)
src/librbd/mirror/snapshot/CreatePrimaryRequest.cc
src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc
src/test/librbd/test_mirroring.cc