From: Haomai Wang Date: Wed, 14 Jan 2015 14:51:58 +0000 (+0800) Subject: AsyncConnection: Don't increment connect_seq if connect failed X-Git-Tag: v0.93~247^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f7f25b4cbb148ba157fc84d9c37d45baefd0156a;p=ceph.git AsyncConnection: Don't increment connect_seq if connect failed If connection sent many messages without acked, then it was marked down. Next we get a new connection, it will issue a connect_msg with connect_seq=0, server side need to detect "connect_seq==0 && existing->connect_seq >0", so it will reset out_q and detect remote reset. But if client side failed before sending connect_msg, now it will issue a connect_msg with non-zero connect_seq which will cause server-side can't detect exist remote reset. Server-side will reply a non-zero in_seq and cause client crash. Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index 556704ec8e4d..16830e360605 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -1998,7 +1998,7 @@ void AsyncConnection::fault() return; } - if (state != STATE_CONNECTING) { + if (!(state >= STATE_CONNECTING && state < STATE_CONNECTING_READY)) { // policy maybe empty when state is in accept if (policy.server || (state >= STATE_ACCEPTING && state < STATE_ACCEPTING_WAIT_SEQ)) { ldout(async_msgr->cct, 0) << __func__ << " server, going to standby" << dendl; @@ -2017,6 +2017,7 @@ void AsyncConnection::fault() if (backoff > async_msgr->cct->_conf->ms_max_backoff) backoff.set_from_double(async_msgr->cct->_conf->ms_max_backoff); } + state = STATE_CONNECTING; ldout(async_msgr->cct, 10) << __func__ << " waiting " << backoff << dendl; }