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: v12.2.9~32^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=acba9dac57eede26f510efcdf94b36170a9e4d7b;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 28678172b17..9860089a303 100644 --- a/src/tools/rbd_mirror/ImageReplayer.cc +++ b/src/tools/rbd_mirror/ImageReplayer.cc @@ -653,6 +653,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); @@ -664,8 +667,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);