From: Haomai Wang Date: Tue, 12 Jul 2016 17:26:04 +0000 (+0800) Subject: msg/async/AsyncConnection: fix _conn_prefix racing when stopped X-Git-Tag: ses5-milestone5~107^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3a43a0bb34b1c74b19dcdc0401fd6adbc6b94b34;p=ceph.git msg/async/AsyncConnection: fix _conn_prefix racing when stopped When the connection is lossy and enter fault, it will dispatch reset event. If cleanup handler is executed as well as ms_handle_reset call mark_down, it may exists racing for "cs". cleanup handler will reset "cs" but _conn_prefix in mark_down will access "cs". Signed-off-by: Haomai Wang --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index c682dd115858..498cb03ff665 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -28,7 +28,7 @@ #undef dout_prefix #define dout_prefix _conn_prefix(_dout) ostream& AsyncConnection::_conn_prefix(std::ostream *_dout) { - int fd = cs ? cs.fd() : -1; + int fd = (cs && state != STATE_CLOSED) ? cs.fd() : -1; return *_dout << "-- " << async_msgr->get_myinst().addr << " >> " << peer_addr << " conn(" << this << " sd=" << fd << " :" << port << " s=" << get_state_name(state)