From 7313d5439d62fd94898fc2c63f279c0e7ad63ae6 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 25 Apr 2018 15:37:57 -0400 Subject: [PATCH] rbd-mirror: properly translate remote tag mirror uuid for local mirror Fixes: http://tracker.ceph.com/issues/23876 Signed-off-by: Jason Dillaman --- src/tools/rbd_mirror/ImageReplayer.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/tools/rbd_mirror/ImageReplayer.cc b/src/tools/rbd_mirror/ImageReplayer.cc index 482f5e073f7..de6ae330860 100644 --- a/src/tools/rbd_mirror/ImageReplayer.cc +++ b/src/tools/rbd_mirror/ImageReplayer.cc @@ -1062,12 +1062,13 @@ void ImageReplayer::handle_get_remote_tag(int r) { template void ImageReplayer::allocate_local_tag() { - dout(20) << dendl; + dout(15) << dendl; std::string mirror_uuid = m_replay_tag_data.mirror_uuid; - if (mirror_uuid == librbd::Journal<>::LOCAL_MIRROR_UUID || - mirror_uuid == m_local_mirror_uuid) { + if (mirror_uuid == librbd::Journal<>::LOCAL_MIRROR_UUID) { mirror_uuid = m_remote_image.mirror_uuid; + } else if (mirror_uuid == m_local_mirror_uuid) { + mirror_uuid = librbd::Journal<>::LOCAL_MIRROR_UUID; } else if (mirror_uuid == librbd::Journal<>::ORPHAN_MIRROR_UUID) { dout(5) << "encountered image demotion: stopping" << dendl; Mutex::Locker locker(m_lock); @@ -1081,10 +1082,9 @@ void ImageReplayer::allocate_local_tag() { predecessor.mirror_uuid = librbd::Journal<>::LOCAL_MIRROR_UUID; } - dout(20) << "mirror_uuid=" << mirror_uuid << ", " - << "predecessor_mirror_uuid=" << predecessor.mirror_uuid << ", " - << "replay_tag_tid=" << m_replay_tag_tid << ", " - << "replay_tag_data=" << m_replay_tag_data << dendl; + dout(15) << "mirror_uuid=" << mirror_uuid << ", " + << "predecessor=" << predecessor << ", " + << "replay_tag_tid=" << m_replay_tag_tid << dendl; Context *ctx = create_context_callback< ImageReplayer, &ImageReplayer::handle_allocate_local_tag>(this); m_local_journal->allocate_tag(mirror_uuid, predecessor, ctx); @@ -1092,7 +1092,8 @@ void ImageReplayer::allocate_local_tag() { template void ImageReplayer::handle_allocate_local_tag(int r) { - dout(20) << "r=" << r << dendl; + dout(15) << "r=" << r << ", " + << "tag_tid=" << m_local_journal->get_tag_tid() << dendl; if (r < 0) { derr << "failed to allocate journal tag: " << cpp_strerror(r) << dendl; -- 2.39.5