]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: protect against journal replay shutdown race condition
authorJason Dillaman <dillaman@redhat.com>
Fri, 11 Mar 2016 13:19:05 +0000 (08:19 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 11 Mar 2016 14:07:46 +0000 (09:07 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/journal/Replay.cc

index 4e5c95a6b583106832d2f50ae1e5ca9bd63c2017..87781194bb75113884f9df730ca921dcf1be31fd 100644 (file)
@@ -168,7 +168,8 @@ void Replay<I>::shut_down(bool cancel_ops, Context *on_finish) {
       if (cancel_ops) {
         // cancel ops that are waiting to start (waiting for
         // OpFinishEvent or waiting for ready)
-        if (op_event.on_start_ready == nullptr) {
+        if (op_event.on_start_ready == nullptr &&
+            op_event.on_op_finish_event != nullptr) {
           cancel_op_tids.push_back(op_event_pair.first);
         }
       } else if (op_event.on_op_finish_event != nullptr) {
@@ -176,9 +177,8 @@ void Replay<I>::shut_down(bool cancel_ops, Context *on_finish) {
         Context *on_op_finish_event = nullptr;
         std::swap(on_op_finish_event, op_event.on_op_finish_event);
         m_image_ctx.op_work_queue->queue(on_op_finish_event, 0);
-      } else {
+      } else if (op_event.on_start_ready != nullptr) {
         // waiting for op ready
-        assert(op_event.on_start_ready != nullptr);
         op_event_pair.second.finish_on_ready = true;
       }
     }