summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKefu Chai <tchaikov@gmail.com>2016-02-17 10:21:29 +0100
committerKefu Chai <tchaikov@gmail.com>2016-02-17 10:21:29 +0100
commit22c6d3549e1eb27145686e5b3daaf412765e00c7 (patch)
tree50a939b87fd9dd96a5757d1f44c51653cde39449
parentMerge pull request #7520 from renhwsky/renhw-wip-mon-monitor (diff)
parentxio: avoid trying bind to port we know will fail (diff)
downloadceph-22c6d3549e1eb27145686e5b3daaf412765e00c7.tar.xz
ceph-22c6d3549e1eb27145686e5b3daaf412765e00c7.zip
Merge pull request #7603 from roidayan/xio_fixes
Xio fixes Reviewed-by: Matt Benjamin <mbenjamin@redhat.com> Reviewed-by: Casey Bodley <cbodley@redhat.com>
-rw-r--r--src/msg/xio/XioConnection.cc10
-rw-r--r--src/msg/xio/XioMessenger.cc9
-rw-r--r--src/msg/xio/XioPortal.cc4
-rw-r--r--src/msg/xio/XioPortal.h6
4 files changed, 20 insertions, 9 deletions
diff --git a/src/msg/xio/XioConnection.cc b/src/msg/xio/XioConnection.cc
index 2f590910804..799a87b4c4e 100644
--- a/src/msg/xio/XioConnection.cc
+++ b/src/msg/xio/XioConnection.cc
@@ -17,7 +17,7 @@
#include "XioConnection.h"
#include "XioMessenger.h"
#include "messages/MDataPing.h"
-
+#include "msg/msg_types.h"
#include "auth/none/AuthNoneProtocol.h" // XXX
#include "include/assert.h"
@@ -398,7 +398,7 @@ int XioConnection::on_msg_req(struct xio_session *session,
peer_type = hdr.peer_type;
peer_addr = hdr.addr;
peer.addr = peer_addr;
- peer.name = hdr.hdr->src;
+ peer.name = entity_name_t(hdr.hdr->src);
if (xio_conn_type == XioConnection::PASSIVE) {
/* XXX kick off feature/authn/authz negotiation
* nb: very possibly the active side should initiate this, but
@@ -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 a920f7eabe3..a1f5de09ae5 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 */
diff --git a/src/msg/xio/XioPortal.cc b/src/msg/xio/XioPortal.cc
index 6c0065902d2..c158764d3aa 100644
--- a/src/msg/xio/XioPortal.cc
+++ b/src/msg/xio/XioPortal.cc
@@ -76,8 +76,10 @@ int XioPortals::bind(struct xio_session_ops *ops, const string& base_uri,
// try ports within the configured range
for (; port_min <= port_max; port_min++) {
r = portals[i]->bind(ops, base_uri, port_min, &result_port);
- if (r == 0)
+ if (r == 0) {
+ port_min++;
break;
+ }
}
if (r != 0) {
lderr(msgr->cct) << "portal.bind unable to bind to " << base_uri
diff --git a/src/msg/xio/XioPortal.h b/src/msg/xio/XioPortal.h
index 3bbc31bddad..04e16d22a7e 100644
--- a/src/msg/xio/XioPortal.h
+++ b/src/msg/xio/XioPortal.h
@@ -16,6 +16,8 @@
#ifndef XIO_PORTAL_H
#define XIO_PORTAL_H
+#include <string>
+
extern "C" {
#include "libxio.h"
}
@@ -427,8 +429,10 @@ public:
}
for (p_ix = 0; p_ix < nportals; ++p_ix) {
+ string thread_name = "ms_xio_";
+ thread_name.append(std::to_string(p_ix));
portal = portals[p_ix];
- portal->create(portal->portal_id);
+ portal->create(thread_name.c_str());
}
}