]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
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)
committerPrashant D <pdhange@redhat.com>
Wed, 23 May 2018 13:25:15 +0000 (09:25 -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 39dc9933d013182f20a1727decd7746379127744..e8de2fa7be7f38ac824d968b0deb9ef366b33820 100644 (file)
@@ -1238,12 +1238,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();
@@ -1303,6 +1309,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);