From: Haomai Wang Date: Mon, 4 Jul 2016 04:06:34 +0000 (+0800) Subject: msg/async/AsyncConnection: add REPLACING write status to indicate replacing X-Git-Tag: ses5-milestone5~429^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=64405c956dd0bc47727de413d3c368a51abdd3d4;p=ceph.git msg/async/AsyncConnection: add REPLACING write status to indicate replacing When replacing, we don't expect any AsyncConnection dispatch new event which will cause thing chaos Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index f5147dfa486..a6966c737f7 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -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; } diff --git a/src/msg/async/AsyncConnection.h b/src/msg/async/AsyncConnection.h index 5d81afc8264..4fa9b75915f 100644 --- a/src/msg/async/AsyncConnection.h +++ b/src/msg/async/AsyncConnection.h @@ -316,6 +316,7 @@ class AsyncConnection : public Connection { Mutex write_lock; enum class WriteStatus { NOWRITE, + REPLACING, CANWRITE, CLOSED };