]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rbd-mirror: prevent image deletion if remote image is not primary 63270/head
authorVinayBhaskar-V <vvarada@redhat.com>
Tue, 13 May 2025 20:25:44 +0000 (01:55 +0530)
committerVinayBhaskar-V <vvarada@redhat.com>
Tue, 22 Jul 2025 19:52:41 +0000 (19:52 +0000)
commite14afbc95a5fb8f5a33e7ea23a035992b966d671
treeab76a1e7c96bdf8b26ff268b6492672ca4334c98
parente1f7b2c3a5b8a983581263b4a7be4c17f4d18174
rbd-mirror: prevent image deletion if remote image is not primary

A resync on a mirrored image may incorrectly results in the local
image being deleted even when the remote image is no longer primary.
This issue can occur under the following conditions:
* if  resync is requested on the secondary before the remote image has
  been fully demoted
* if the demotion of the primary image is not mirrored
  due to the rbd-mirror daemon being offline.

This can be fixed by ensuring that image deletion during a resync is
only allowed when the remote image is confirmed to be primary.

This commit fixes the issue only for snapshot based mirroring mode

Fixes: https://tracker.ceph.com/issues/70948
Signed-off-by: VinayBhaskar-V <vvarada@redhat.com>
qa/workunits/rbd/rbd_mirror.sh
src/test/rbd_mirror/image_replayer/snapshot/test_mock_Replayer.cc
src/tools/rbd_mirror/image_replayer/snapshot/PrepareReplayRequest.cc
src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc
src/tools/rbd_mirror/image_replayer/snapshot/Replayer.h