]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
rbd-mirror: prevent image deletion if remote image is not primary
authorVinayBhaskar-V <vvarada@redhat.com>
Tue, 13 May 2025 20:25:44 +0000 (01:55 +0530)
committerVinayBhaskar-V <vvarada@redhat.com>
Tue, 29 Jul 2025 13:54:41 +0000 (13:54 +0000)
commit23d15f270acd192fe8aa76918558316a57594ad9
treebc359eb5df1b1acf91a25c5465750130cfee5b73
parent3663568d78e4a34971dfb905a861fa3e40f452b1
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>
(cherry picked from commit e14afbc95a5fb8f5a33e7ea23a035992b966d671)
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