]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: fix bootstrapping
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Fri, 28 Feb 2025 14:47:01 +0000 (20:17 +0530)
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Thu, 24 Apr 2025 15:56:31 +0000 (21:26 +0530)
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 <prasanna.kalever@redhat.com>
src/tools/rbd_mirror/group_replayer/BootstrapRequest.cc

index cf8ba31559ae2be12b21a2d665ca9676208f24d5..33d6ae80f17aada1338db3a68aeafacf4c4c77d1 100644 (file)
@@ -1088,7 +1088,8 @@ void BootstrapRequest<I>::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<I>::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);
 }