From: Haomai Wang Date: Tue, 10 Feb 2015 14:19:17 +0000 (+0800) Subject: AsyncConnection: Allow reply reset tag if first hit X-Git-Tag: suse_latest~36^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=25d53f690c234d0d3a2c8a5eea352f053988caec;p=ceph.git AsyncConnection: Allow reply reset tag if first hit Commit 7bb7b1ec1e3f8b4141dedc3b88aa2aac476876d4 prevent replying reset tag if no session reset happen. But if initiator has state, server side is a fresh connection, server side need to reply a reset tag. Rename "once_session_reset" to "allow_session_reset" to solve this problem and avoid reset/retry tag loop problem. Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index a9d7f510f84b..c95ec09e49a8 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -180,7 +180,7 @@ AsyncConnection::AsyncConnection(CephContext *cct, AsyncMessenger *m, EventCente port(-1), lock("AsyncConnection::lock"), open_write(false), keepalive(false), recv_buf(NULL), recv_max_prefetch(MIN(msgr->cct->_conf->ms_tcp_prefetch_max_size, TCP_PREFETCH_MIN_SIZE)), recv_start(0), recv_end(0), stop_lock("AsyncConnection::stop_lock"), - got_bad_auth(false), authorizer(NULL), replacing(false), once_session_reset(false), + got_bad_auth(false), authorizer(NULL), replacing(false), allow_session_reset(true), is_reset_from_peer(false), state_buffer(NULL), state_offset(0), net(cct), center(c) { read_handler.reset(new C_handle_read(this)); @@ -1655,11 +1655,11 @@ int AsyncConnection::handle_connect_msg(ceph_msg_connect &connect, bufferlist &a assert(connect.connect_seq > existing->connect_seq); assert(connect.global_seq >= existing->peer_global_seq); if (policy.resetcheck && // RESETSESSION only used by servers; peers do not reset each other - existing->connect_seq == 0 && once_session_reset) { + existing->connect_seq == 0 && allow_session_reset) { ldout(async_msgr->cct, 0) << __func__ << " accept we reset (peer sent cseq " << connect.connect_seq << ", " << existing << ".cseq = " << existing->connect_seq << "), sending RESETSESSION" << dendl; - once_session_reset = false; + allow_session_reset = false; return _reply_accept(CEPH_MSGR_TAG_RESETSESSION, connect, reply, authorizer_reply); } @@ -1812,6 +1812,7 @@ int AsyncConnection::handle_connect_msg(ceph_msg_connect &connect, bufferlist &a lock.Lock(); replacing = false; + allow_session_reset = true; if (r < 0) { ldout(async_msgr->cct, 1) << __func__ << " existing race replacing process for addr=" << peer_addr << " just fail later one(this)" << dendl; @@ -2068,7 +2069,7 @@ void AsyncConnection::was_session_reset() in_seq = 0; connect_seq = 0; in_seq_acked = 0; - once_session_reset = true; + allow_session_reset = true; } void AsyncConnection::_stop() diff --git a/src/msg/async/AsyncConnection.h b/src/msg/async/AsyncConnection.h index e4e7aff794d9..b1a7767869e3 100644 --- a/src/msg/async/AsyncConnection.h +++ b/src/msg/async/AsyncConnection.h @@ -265,7 +265,7 @@ class AsyncConnection : public Connection { // there won't exists conflicting connection so we use // "replacing" to skip RESETSESSION to avoid detect wrong // presentation - bool once_session_reset; + bool allow_session_reset; bool is_reset_from_peer; atomic_t stopping;