rbd-mirror: don't reregister asok hook in process entry thread
authorMykola Golub <mgolub@suse.com>
Wed, 16 May 2018 07:34:50 +0000 (10:34 +0300)
committerJason Dillaman <dillaman@redhat.com>
Wed, 16 May 2018 18:07:28 +0000 (14:07 -0400)
It might get stuck if the asok is busy executing a command.
Instead kick status update, which will call reregister on finish.

Fixes: http://tracker.ceph.com/issues/24141
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit 43e50bd582ba2d1b66f55d7f8d2b7f030da99ee6)

src/tools/rbd_mirror/ImageReplayer.cc

index 3af0e3a0d5c5bd01aa18f91f1fd9d7877d4b0483..367fbb90c884bd0e3d22ed0d6aa48e617b1a1748 100644 (file)
@@ -1212,12 +1212,18 @@ void ImageReplayer<I>::handle_process_entry_ready(int r) {
   dout(20) << dendl;
   assert(r == 0);
 
+  bool update_status = false;
   {
     RWLock::RLocker snap_locker(m_local_image_ctx->snap_lock);
-    m_local_image_name = m_local_image_ctx->name;
+    if (m_local_image_name != m_local_image_ctx->name) {
+      m_local_image_name = m_local_image_ctx->name;
+      update_status = true;
+    }
   }
 
-  reregister_admin_socket_hook();
+  if (update_status) {
+    reschedule_update_status_task(0);
+  }
 
   // attempt to process the next event
   handle_replay_ready();
@@ -1277,6 +1283,8 @@ bool ImageReplayer<I>::start_mirror_image_status_update(bool force,
 
 template <typename I>
 void ImageReplayer<I>::finish_mirror_image_status_update() {
+  reregister_admin_socket_hook();
+
   Context *on_finish = nullptr;
   {
     Mutex::Locker locker(m_lock);