------------------------------------------------------------ revno: 80 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Peter Somogyi <[EMAIL PROTECTED]> branch nick: ctdb timestamp: Mon 2007-04-23 12:45:14 +0200 message: fixed ctdb/ib bug at reject event reverted my suggestion in debug.c (based on my false error detection) modified: ib/ibwrapper.c ibwrapper.c-20061204130028-0125b4f5a72f4b11 lib/util/debug.c debug.c-20070417155854-2i3crb0irl716qft-1 === modified file 'ib/ibwrapper.c' --- a/ib/ibwrapper.c 2007-04-20 12:26:19 +0000 +++ b/ib/ibwrapper.c 2007-04-23 10:45:14 +0000 @@ -428,6 +428,7 @@ 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; } @@ -520,9 +521,10 @@ if (conn) { 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;
@@ -556,22 +558,26 @@ return; error: - if (event!=NULL && (rc=rdma_ack_cm_event(event))) { - DEBUG(0, ("rdma_ack_cm_event failed with %d\n", rc)); - } - 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, === modified file 'lib/util/debug.c' --- a/lib/util/debug.c 2007-04-20 15:04:00 +0000 +++ b/lib/util/debug.c 2007-04-23 10:45:14 +0000 @@ -30,12 +30,12 @@ char *s = NULL; va_start(ap, format); - s = talloc_vasprintf(NULL, format, ap); + vasprintf(&s, format, ap); va_end(ap); gettimeofday(&tm, NULL); printf("%-8.8d.%-6.6d [%d]: %s", (int)tm.tv_sec, (int)tm.tv_usec, (int)getpid(), s); fflush(stdout); - talloc_free(s); + free(s); } ------------------------------------------------------- -- Peter Somogyi Gamax Kft Bartok Bela ut 15/D H-1114, Budapest, Hungary e-mail: [EMAIL PROTECTED]
------------------------------------------------------------ revno: 80 revision-id: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Peter Somogyi <[EMAIL PROTECTED]> branch nick: ctdb timestamp: Mon 2007-04-23 12:45:14 +0200 message: fixed ctdb/ib bug at reject event reverted my suggestion in debug.c (based on my false error detection) modified: ib/ibwrapper.c ibwrapper.c-20061204130028-0125b4f5a72f4b11 lib/util/debug.c debug.c-20070417155854-2i3crb0irl716qft-1 === modified file 'ib/ibwrapper.c' --- a/ib/ibwrapper.c 2007-04-20 12:26:19 +0000 +++ b/ib/ibwrapper.c 2007-04-23 10:45:14 +0000 @@ -428,6 +428,7 @@ 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; } @@ -520,9 +521,10 @@ if (conn) { 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; @@ -556,22 +558,26 @@ return; error: - if (event!=NULL && (rc=rdma_ack_cm_event(event))) { - DEBUG(0, ("rdma_ack_cm_event failed with %d\n", rc)); - } - 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, === modified file 'lib/util/debug.c' --- a/lib/util/debug.c 2007-04-20 15:04:00 +0000 +++ b/lib/util/debug.c 2007-04-23 10:45:14 +0000 @@ -30,12 +30,12 @@ char *s = NULL; va_start(ap, format); - s = talloc_vasprintf(NULL, format, ap); + vasprintf(&s, format, ap); va_end(ap); gettimeofday(&tm, NULL); printf("%-8.8d.%-6.6d [%d]: %s", (int)tm.tv_sec, (int)tm.tv_usec, (int)getpid(), s); fflush(stdout); - talloc_free(s); + free(s); }