From bbdc545ec1602f928c89c85d61c975abdf67be5b Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 19 Sep 2018 14:24:31 -0400 Subject: [PATCH] rbd-mirror: instantiate the status formatter before changing state This will avoid a possible race between pre-queued status updates firing between the time the state has been changed and the formatter has been instantiated. Fixes: http://tracker.ceph.com/issues/36084 Signed-off-by: Jason Dillaman --- src/tools/rbd_mirror/ImageReplayer.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/rbd_mirror/ImageReplayer.cc b/src/tools/rbd_mirror/ImageReplayer.cc index bca0f7a6506..35650e5d3e4 100644 --- a/src/tools/rbd_mirror/ImageReplayer.cc +++ b/src/tools/rbd_mirror/ImageReplayer.cc @@ -630,6 +630,9 @@ void ImageReplayer::handle_start_replay(int r) { return; } + m_replay_status_formatter = + ReplayStatusFormatter::create(m_remote_journaler, m_local_mirror_uuid); + Context *on_finish(nullptr); { Mutex::Locker locker(m_lock); @@ -641,8 +644,6 @@ void ImageReplayer::handle_start_replay(int r) { m_event_preprocessor = EventPreprocessor::create( *m_local_image_ctx, *m_remote_journaler, m_local_mirror_uuid, &m_client_meta, m_threads->work_queue); - m_replay_status_formatter = - ReplayStatusFormatter::create(m_remote_journaler, m_local_mirror_uuid); update_mirror_image_status(true, boost::none); reschedule_update_status_task(30);