diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-07-10 08:06:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:59:20 -0500 |
commit | 6504900f1f52927adab3489b8d04b6644ceaee7d (patch) | |
tree | 893cadba231a529f320046429767cedf8b0eec30 /source4/cluster/ctdb/ib/ibwrapper.c | |
parent | d4e2d157cbce5a1cdc75efb5ced75d9608a0f7df (diff) | |
download | samba-6504900f1f52927adab3489b8d04b6644ceaee7d.tar.gz samba-6504900f1f52927adab3489b8d04b6644ceaee7d.tar.bz2 samba-6504900f1f52927adab3489b8d04b6644ceaee7d.zip |
r23806: update Samba4 with the latest ctdb code.
This doesn't get the ctdb code fully working in Samba4, it just gets
it building and not breaking non-clustered use of Samba. It will take
a bit longer to update some of the calling ctdb_cluster.c code to make
it work correctly in Samba4.
Note also that Samba4 now only links to the client portion of
ctdb. For the moment I am leaving the ctdbd as a separate daemon,
which you install separately from http://ctdb.samba.org/.
(This used to be commit b196077cbb55cbecad87065133c2d67198e31066)
Diffstat (limited to 'source4/cluster/ctdb/ib/ibwrapper.c')
-rw-r--r-- | source4/cluster/ctdb/ib/ibwrapper.c | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/source4/cluster/ctdb/ib/ibwrapper.c b/source4/cluster/ctdb/ib/ibwrapper.c index 8ef798c88b..31acbc4a2d 100644 --- a/source4/cluster/ctdb/ib/ibwrapper.c +++ b/source4/cluster/ctdb/ib/ibwrapper.c @@ -37,8 +37,9 @@ #include "lib/events/events.h" #include "ibwrapper.h" +#include <infiniband/kern-abi.h> +#include <rdma/rdma_cma_abi.h> #include <rdma/rdma_cma.h> -#include "infiniband/sa-kern-abi.h" #include "ibwrapper_internal.h" #include "lib/util/dlinklist.h" @@ -82,7 +83,7 @@ static void *ibw_alloc_mr(struct ibw_ctx_priv *pctx, struct ibw_conn_priv *pconn static void ibw_free_mr(char **ppbuf, struct ibv_mr **ppmr) { - DEBUG(10, ("ibw_free_mr(%u %u)\n", (uint32_t)*ppbuf, (uint32_t)*ppmr)); + DEBUG(10, ("ibw_free_mr(%p %p)\n", *ppbuf, *ppmr)); if (*ppmr!=NULL) { ibv_dereg_mr(*ppmr); *ppmr = NULL; @@ -132,7 +133,7 @@ static int ibw_init_memory(struct ibw_conn *conn) static int ibw_ctx_priv_destruct(struct ibw_ctx_priv *pctx) { - DEBUG(10, ("ibw_ctx_priv_destruct(%u)\n", (uint32_t)pctx)); + DEBUG(10, ("ibw_ctx_priv_destruct(%p)\n", pctx)); /* destroy cm */ if (pctx->cm_channel) { @@ -154,7 +155,7 @@ static int ibw_ctx_priv_destruct(struct ibw_ctx_priv *pctx) static int ibw_ctx_destruct(struct ibw_ctx *ctx) { - DEBUG(10, ("ibw_ctx_destruct(%u)\n", (uint32_t)ctx)); + DEBUG(10, ("ibw_ctx_destruct(%p)\n", ctx)); return 0; } @@ -216,7 +217,7 @@ static int ibw_wr_destruct(struct ibw_wr *wr) static int ibw_conn_destruct(struct ibw_conn *conn) { - DEBUG(10, ("ibw_conn_destruct(%u)\n", (uint32_t)conn)); + DEBUG(10, ("ibw_conn_destruct(%p)\n", conn)); /* important here: ctx is a talloc _parent_ */ DLIST_REMOVE(conn->ctx->conn_list, conn); @@ -427,6 +428,7 @@ static void ibw_event_handler_cm(struct event_context *ev, rc = rdma_get_cm_event(pctx->cm_channel, &event); if (rc) { ctx->state = IBWS_ERROR; + event = NULL; sprintf(ibw_lasterr, "rdma_get_cm_event error %d\n", rc); goto error; } @@ -492,7 +494,7 @@ static void ibw_event_handler_cm(struct event_context *ev, case RDMA_CM_EVENT_ESTABLISHED: /* expected after ibw_accept and ibw_connect[not directly] */ - DEBUG(0, ("ESTABLISHED (conn: %p)\n", cma_id->context)); + DEBUG(1, ("ESTABLISHED (conn: %p)\n", cma_id->context)); conn = talloc_get_type(cma_id->context, struct ibw_conn); assert(conn!=NULL); /* important assumption */ @@ -513,17 +515,21 @@ static void ibw_event_handler_cm(struct event_context *ev, sprintf(ibw_lasterr, "RDMA_CM_EVENT_CONNECT_ERROR, error %d\n", event->status); case RDMA_CM_EVENT_UNREACHABLE: sprintf(ibw_lasterr, "RDMA_CM_EVENT_UNREACHABLE, error %d\n", event->status); + goto error; case RDMA_CM_EVENT_REJECTED: sprintf(ibw_lasterr, "RDMA_CM_EVENT_REJECTED, error %d\n", event->status); + DEBUG(1, ("cm event handler: %s", ibw_lasterr)); conn = talloc_get_type(cma_id->context, struct ibw_conn); if (conn) { + /* must be done BEFORE connstate */ if ((rc=rdma_ack_cm_event(event))) DEBUG(0, ("reject/rdma_ack_cm_event failed with %d\n", rc)); - event = NULL; - pconn = talloc_get_type(conn->internal, struct ibw_conn_priv); - ibw_conn_priv_destruct(pconn); + event = NULL; /* not to touch cma_id or conn */ + conn->state = IBWC_ERROR; + /* it should free the conn */ + pctx->connstate_func(NULL, conn); } - goto error; + break; /* this is not strictly an error */ case RDMA_CM_EVENT_DISCONNECTED: DEBUG(11, ("RDMA_CM_EVENT_DISCONNECTED\n")); @@ -555,22 +561,26 @@ static void ibw_event_handler_cm(struct event_context *ev, return; error: - if (event!=NULL && (rc=rdma_ack_cm_event(event))) { - sprintf(ibw_lasterr, "rdma_ack_cm_event failed with %d\n", rc); - goto error; - } - DEBUG(0, ("cm event handler: %s", ibw_lasterr)); - if (cma_id!=pctx->cm_id) { - conn = talloc_get_type(cma_id->context, struct ibw_conn); - if (conn) - conn->state = IBWC_ERROR; - pctx->connstate_func(NULL, conn); - } else { - ctx->state = IBWS_ERROR; - pctx->connstate_func(ctx, NULL); + if (event!=NULL) { + if (cma_id!=NULL && cma_id!=pctx->cm_id) { + conn = talloc_get_type(cma_id->context, struct ibw_conn); + if (conn) { + conn->state = IBWC_ERROR; + pctx->connstate_func(NULL, conn); + } + } else { + ctx->state = IBWS_ERROR; + pctx->connstate_func(ctx, NULL); + } + + if ((rc=rdma_ack_cm_event(event))!=0) { + DEBUG(0, ("rdma_ack_cm_event failed with %d\n", rc)); + } } + + return; } static void ibw_event_handler_verbs(struct event_context *ev, @@ -966,7 +976,11 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr, pctx->cm_channel_event = event_add_fd(pctx->ectx, pctx, pctx->cm_channel->fd, EVENT_FD_READ, ibw_event_handler_cm, ctx); +#if RDMA_USER_CM_MAX_ABI_VERSION >= 2 rc = rdma_create_id(pctx->cm_channel, &pctx->cm_id, ctx, RDMA_PS_TCP); +#else + rc = rdma_create_id(pctx->cm_channel, &pctx->cm_id, ctx); +#endif if (rc) { rc = errno; sprintf(ibw_lasterr, "rdma_create_id error %d\n", rc); @@ -1087,7 +1101,11 @@ int ibw_connect(struct ibw_conn *conn, struct sockaddr_in *serv_addr, void *conn } /* init cm */ +#if RDMA_USER_CM_MAX_ABI_VERSION >= 2 rc = rdma_create_id(pctx->cm_channel, &pconn->cm_id, conn, RDMA_PS_TCP); +#else + rc = rdma_create_id(pctx->cm_channel, &pconn->cm_id, conn); +#endif if (rc) { rc = errno; sprintf(ibw_lasterr, "ibw_connect/rdma_create_id error %d\n", rc); |