]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: prevent infinite loop when computing replay status
authorJason Dillaman <dillaman@redhat.com>
Thu, 4 May 2017 21:57:34 +0000 (17:57 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 27 Jun 2017 01:53:13 +0000 (21:53 -0400)
If the image had a non-primary predecessor epoch whose tag tid
duplicates an epoch within its own journal, an infinite loop
would result.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 3f179bf86216540d8e25aad469c604f96f6aecd8)

src/tools/rbd_mirror/image_replayer/ReplayStatusFormatter.cc

index 917a706594a07c9f7c30b9ff9429333f7dbd6d0a..c3a04007bcb8641e16781ef0cc5d502f3432761c 100644 (file)
@@ -195,7 +195,13 @@ void ReplayStatusFormatter<I>::handle_update_tag_cache(uint64_t master_tag_tid,
     }
   }
 
-  if (tag_data.predecessor.tag_tid == 0) {
+  if (tag_data.predecessor.mirror_uuid !=
+        librbd::Journal<>::LOCAL_MIRROR_UUID &&
+      tag_data.predecessor.mirror_uuid !=
+        librbd::Journal<>::ORPHAN_MIRROR_UUID) {
+    dout(20) << "hit remote image non-primary epoch" << dendl;
+    tag_data.predecessor.tag_tid = mirror_tag_tid;
+  } else if (tag_data.predecessor.tag_tid == 0) {
     // We failed. Don't consider this fatal, just terminate retrieving.
     dout(20) << "making fake tag" << dendl;
     tag_data.predecessor.tag_tid = mirror_tag_tid;