]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd/mirror/snapshot: avoid UnlinkPeerRequest with a unlinked peer 41302/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 11:34:22 +0000 (13:34 +0200)
commitd1869fcccd572dec9b7bd1023478fd988efba8ff
treeeddddfef128963d02f12b9b82f0794f356aae1a4
parent37a000fa8a1d2dde284b12338ae6f843553d26e6
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