]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: fix issues detected when attempting clean shut down
authorJason Dillaman <dillaman@redhat.com>
Tue, 19 Jul 2016 19:42:27 +0000 (15:42 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 17 Aug 2016 17:22:06 +0000 (13:22 -0400)
Fixed lockdep issue from status update callback and fixed the
potential for a stuck status state.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 0275c7ca23b27dc5250cd33f317e2273470a9fe8)

src/tools/rbd_mirror/ImageReplayer.cc

index 5de20db2312fde451089791942bcd21895e79de3..c5e81876a64fe9764860ceeae3d30fa6e2fc5ffb 100644 (file)
@@ -640,6 +640,7 @@ void ImageReplayer<I>::stop(Context *on_finish, bool manual)
 {
   dout(20) << "on_finish=" << on_finish << dendl;
 
+  image_replayer::BootstrapRequest<I> *bootstrap_request = nullptr;
   bool shut_down_replay = false;
   bool running = true;
   {
@@ -651,7 +652,8 @@ void ImageReplayer<I>::stop(Context *on_finish, bool manual)
        if (m_state == STATE_STARTING) {
          dout(20) << "canceling start" << dendl;
          if (m_bootstrap_request) {
-           m_bootstrap_request->cancel();
+            bootstrap_request = m_bootstrap_request;
+            bootstrap_request->get();
          }
        } else {
          dout(20) << "interrupting replay" << dendl;
@@ -666,6 +668,12 @@ void ImageReplayer<I>::stop(Context *on_finish, bool manual)
     }
   }
 
+  // avoid holding lock since bootstrap request will update status
+  if (bootstrap_request != nullptr) {
+    bootstrap_request->cancel();
+    bootstrap_request->put();
+  }
+
   if (!running) {
     dout(20) << "not running" << dendl;
     if (on_finish) {
@@ -1180,9 +1188,12 @@ void ImageReplayer<I>::send_mirror_status_update(const OptionalState &opt_state)
     {
       Context *on_req_finish = new FunctionContext(
         [this](int r) {
+          dout(20) << "replay status ready: r=" << r << dendl;
           if (r >= 0) {
-            dout(20) << "replay status ready" << dendl;
             send_mirror_status_update(boost::none);
+          } else if (r == -EAGAIN) {
+            // decrement in-flight status update counter
+            handle_mirror_status_update(r);
           }
         });