]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/AsyncConnection: add REPLACING write status to indicate replacing
authorHaomai Wang <haomai@xsky.com>
Mon, 4 Jul 2016 04:06:34 +0000 (12:06 +0800)
committerHaomai Wang <haomai@xsky.com>
Tue, 12 Jul 2016 15:51:27 +0000 (23:51 +0800)
When replacing, we don't expect any AsyncConnection dispatch new event which
will cause thing chaos

Signed-off-by: Haomai Wang <haomai@xsky.com>
src/msg/async/AsyncConnection.cc
src/msg/async/AsyncConnection.h

index f5147dfa4868ea46ed72361b64eda22ac29f156f..a6966c737f7c8de1d2e3e79c6f2ddc872413ec5e 100644 (file)
@@ -1830,7 +1830,7 @@ ssize_t AsyncConnection::handle_connect_msg(ceph_msg_connect &connect, bufferlis
     _stop();
     dispatch_queue->queue_reset(this);
     ldout(async_msgr->cct, 1) << __func__ << " stop myself to swap existing" << dendl;
-    existing->can_write = WriteStatus::NOWRITE;
+    existing->can_write = WriteStatus::REPLACING;
     existing->open_write = false;
     existing->replacing = true;
     existing->state_offset = 0;
@@ -2083,7 +2083,8 @@ int AsyncConnection::send_message(Message *m)
   } else {
     out_q[m->get_priority()].emplace_back(std::move(bl), m);
     ldout(async_msgr->cct, 15) << __func__ << " inline write is denied, reschedule m=" << m << dendl;
-    center->dispatch_event_external(write_handler);
+    if (can_write != WriteStatus::REPLACING)
+      center->dispatch_event_external(write_handler);
   }
   return 0;
 }
index 5d81afc8264bf9f0afa029d0aede47d939c03c59..4fa9b75915f31bcddf68a6ce11252871ff854ea5 100644 (file)
@@ -316,6 +316,7 @@ class AsyncConnection : public Connection {
   Mutex write_lock;
   enum class WriteStatus {
     NOWRITE,
+    REPLACING,
     CANWRITE,
     CLOSED
   };