]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
xio: check for xio connection error before set as connected
authorRoi Dayan <roid@mellanox.com>
Thu, 4 Feb 2016 17:32:24 +0000 (19:32 +0200)
committerRoi Dayan <roid@mellanox.com>
Thu, 11 Feb 2016 06:54:33 +0000 (08:54 +0200)
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 <roid@mellanox.com>
src/msg/xio/XioConnection.cc
src/msg/xio/XioMessenger.cc

index 51173810778c508ba2cc5062d54d014572740eac..799a87b4c4ea44beed2937a9067e542f76882c93 100644 (file)
@@ -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);
index a920f7eabe3bc70f4b3083483f8e16cc2090437f..a1f5de09ae5386bcb5bcc18ba6704b5a70403eb5 100644 (file)
@@ -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 */