From 99f580a3959240f99061a9ad48ec591b39a9fd46 Mon Sep 17 00:00:00 2001 From: Haomai Wang Date: Tue, 13 Jun 2017 10:19:55 +0800 Subject: [PATCH] msg/async: go to open new session when existing already closed Fixes: http://tracker.ceph.com/issues/20230 Signed-off-by: Haomai Wang --- src/msg/async/AsyncConnection.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 5418abaa0ea86..822dc42771e36 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -1538,8 +1538,15 @@ ssize_t AsyncConnection::handle_connect_msg(ceph_msg_connect &connect, bufferlis // connection's lock existing->lock.lock(); // skip lockdep check (we are locking a second AsyncConnection here) - if (existing->replacing || existing->state == STATE_CLOSED) { - ldout(async_msgr->cct, 1) << __func__ << " existing racing replace or mark_down happened while replacing." + if (existing->state == STATE_CLOSED) { + ldout(async_msgr->cct, 1) << __func__ << " existing already closed." << dendl; + existing->lock.unlock(); + existing = NULL; + goto open; + } + + if (existing->replacing) { + ldout(async_msgr->cct, 1) << __func__ << " existing racing replace happened while replacing." << " existing_state=" << get_state_name(existing->state) << dendl; reply.global_seq = existing->peer_global_seq; r = _reply_accept(CEPH_MSGR_TAG_RETRY_GLOBAL, connect, reply, authorizer_reply); -- 2.39.5