From: Prasanna Kumar Kalever Date: Fri, 28 Feb 2025 14:47:01 +0000 (+0530) Subject: rbd-mirror: fix bootstrapping X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=92be83a03aef619b87c63397ccc74ff421a4db41;p=ceph.git rbd-mirror: fix bootstrapping Issue I: As part of the remove_local_mirror_group if local mirror group global_group_id doesn't match with GroupReplayer instance (m_global_group_id), then remove_local_group() In a case where the daemon is down then group is disabled then removed/added images then re-enabled groups and then brought the daemon back to life, the Groupreplayer instances belonging to same group name will mess leading to path of create_local_mirror_group(), which is wrong. Issue II: Also, in cases where local mirror group global_group_id doesn't match with GroupReplayer instance, if there are ENOENT errors in the bootstrapping then retry the bootstrapping. With out this fix, this will lead to group_replayer destroy of a valid instance. Signed-off-by: Prasanna Kumar Kalever --- diff --git a/src/tools/rbd_mirror/group_replayer/BootstrapRequest.cc b/src/tools/rbd_mirror/group_replayer/BootstrapRequest.cc index cf8ba31559ae2..33d6ae80f17aa 100644 --- a/src/tools/rbd_mirror/group_replayer/BootstrapRequest.cc +++ b/src/tools/rbd_mirror/group_replayer/BootstrapRequest.cc @@ -1088,7 +1088,8 @@ void BootstrapRequest::handle_remove_local_mirror_group(int r) { } m_local_mirror_group.state = cls::rbd::MIRROR_GROUP_STATE_DISABLED; - if (r != -ENOENT && (m_remote_mirror_group.state == cls::rbd::MIRROR_GROUP_STATE_ENABLED && + if (r != -ENOENT && (m_local_mirror_group.global_group_id == m_global_group_id) && + (m_remote_mirror_group.state == cls::rbd::MIRROR_GROUP_STATE_ENABLED && m_remote_mirror_group_primary)) { create_local_mirror_group(); } else { @@ -1319,6 +1320,10 @@ void BootstrapRequest::finish(int r) { } } + if (r == -ENOENT && m_local_mirror_group.global_group_id != m_global_group_id) { + r = -ERESTART; // try again + } + m_on_finish->complete(r); }