From: Jason Dillaman Date: Wed, 19 Sep 2018 18:24:31 +0000 (-0400) Subject: rbd-mirror: instantiate the status formatter before changing state X-Git-Tag: v13.2.3~165^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F24321%2Fhead;p=ceph.git 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 (cherry picked from commit bbdc545ec1602f928c89c85d61c975abdf67be5b) --- diff --git a/src/tools/rbd_mirror/ImageReplayer.cc b/src/tools/rbd_mirror/ImageReplayer.cc index 471cf82169f2..e2b340bf5dfc 100644 --- a/src/tools/rbd_mirror/ImageReplayer.cc +++ b/src/tools/rbd_mirror/ImageReplayer.cc @@ -631,6 +631,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); @@ -642,8 +645,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);