]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rbd-mirror: fix races in snapshot-based mirroring deletion propagation
authorIlya Dryomov <idryomov@gmail.com>
Fri, 21 Jan 2022 12:41:46 +0000 (13:41 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 21 Jan 2022 16:32:36 +0000 (17:32 +0100)
commitd634a1df5b19d61955f2f94c7cc29bd4f3b678c8
treebf2b2970f3724c69ad8b3d4e2c457a9f957cccb3
parentccfbf3e97ed1f50df0adcbec812f1b11fe22cace
rbd-mirror: fix races in snapshot-based mirroring deletion propagation

When remote image is deleted, rbd-mirror can encounter three cases:

  1) no remote image id
  2) no remote mirror metadata
  3) MIRROR_IMAGE_STATE_DISABLING in remote mirror metadata

Commit d4c66ac5c615 ("rbd-mirror: fix issue with snapshot-based
mirroring deletion propagation") fixed case 1.  Cases 2 and 3 remained
broken because for both of them finalize_snapshot_state_builder() would
populate not only remote_mirror_peer_uuid but also remote_image_id,
thus disabling ENOLINK logic in handle_prepare_remote_image() and
handle_bootstrap().  Commit ff60aec2d9ef ("rbd-mirror: fix bootstrap
sequence while the image is removed") touched on case 3, but it made
a difference only for journal-based mirroring.

Stop calling finalize_snapshot_state_builder() on errors.  Instead,
align with journal-based mirroring by filling remote_mirror_peer_uuid
together with remote_mirror_uuid.

Fixes: https://tracker.ceph.com/issues/53963
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/test/rbd_mirror/image_replayer/test_mock_PrepareRemoteImageRequest.cc
src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc
src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.h