From: Roi Dayan Date: Thu, 4 Feb 2016 17:32:24 +0000 (+0200) Subject: xio: check for xio connection error before set as connected X-Git-Tag: v10.1.0~370^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1304e949cc62710b4a5cb504f6c2d336f25dbd88;p=ceph.git xio: check for xio connection error before set as connected Also go through the disconnect method that checks we are connected before passing the conn to xio_disconnect as it might be NULL. Signed-off-by: Roi Dayan --- diff --git a/src/msg/xio/XioConnection.cc b/src/msg/xio/XioConnection.cc index 51173810778c..799a87b4c4ea 100644 --- a/src/msg/xio/XioConnection.cc +++ b/src/msg/xio/XioConnection.cc @@ -605,8 +605,7 @@ int XioConnection::_mark_down(uint32_t flags) if (cstate.policy.resetcheck) cstate.flags |= CState::FLAG_RESET; - // Accelio disconnect - xio_disconnect(conn); + disconnect(); /* XXX this will almost certainly be called again from * on_disconnect_event() */ @@ -685,8 +684,7 @@ int XioConnection::CState::state_fail(Message* m, uint32_t flags) xcon->discard_input_queue(flags|OP_FLAG_LOCKED); xcon->adjust_clru(flags|OP_FLAG_LOCKED|OP_FLAG_LRU); - // Accelio disconnect - xio_disconnect(xcon->conn); + xcon->disconnect(); if (! (flags & OP_FLAG_LOCKED)) pthread_spin_unlock(&xcon->sp); diff --git a/src/msg/xio/XioMessenger.cc b/src/msg/xio/XioMessenger.cc index a920f7eabe3b..a1f5de09ae53 100644 --- a/src/msg/xio/XioMessenger.cc +++ b/src/msg/xio/XioMessenger.cc @@ -1003,7 +1003,6 @@ ConnectionRef XioMessenger::get_connection(const entity_inst_t& dest) delete xcon; return NULL; } - nsessions.inc(); /* this should cause callbacks with user context of conn, but * we can always set it explicitly */ @@ -1017,7 +1016,15 @@ ConnectionRef XioMessenger::get_connection(const entity_inst_t& dest) .out_addr = NULL, .conn_user_context = xcon }; + xcon->conn = xio_connect(&xcp); + if (!xcon->conn) { + xio_session_destroy(xcon->session); + delete xcon; + return NULL; + } + + nsessions.inc(); xcon->connected.set(true); /* sentinel ref */