Rev 59: 2 bugfixes in http://samba.org/~tridge/psomogyi/
psomogyi at gamax.hu
psomogyi at gamax.hu
Thu Feb 1 17:46:45 GMT 2007
------------------------------------------------------------
revno: 59
revision-id: psomogyi at gamax.hu-20070201174644-bdc52k65snouodch
parent: psomogyi at gamax.hu-20070131112455-cl0rqp0e34fxxr1e
committer: Peter Somogyi <psomogyi at gamax.hu>
branch nick: ctdb
timestamp: Thu 2007-02-01 18:46:44 +0100
message:
2 bugfixes
- ibw_stop handling
- ibw_send: < instead of <=
modified:
ib/ibwrapper.c ibwrapper.c-20061204130028-0125b4f5a72f4b11
tests/ibwrapper_test.c ibwrapper_test.c-20061214171730-h11a2z5ed6pt66hj-1
=== modified file 'ib/ibwrapper.c'
--- a/ib/ibwrapper.c 2007-01-30 17:47:26 +0000
+++ b/ib/ibwrapper.c 2007-02-01 17:46:44 +0000
@@ -476,21 +476,10 @@
case RDMA_CM_EVENT_DISCONNECTED:
if (cma_id!=pctx->cm_id) {
- DEBUG(0, ("client DISCONNECT event\n"));
+ DEBUG(0, ("client DISCONNECT event cm_id=%p\n", cma_id));
conn = talloc_get_type(cma_id->context, struct ibw_conn);
conn->state = IBWC_DISCONNECTED;
pctx->connstate_func(NULL, conn);
-
- talloc_free(conn);
-
- /* if we are the last... */
- if (ctx->conn_list==NULL)
- rdma_disconnect(pctx->cm_id);
- } else {
- DEBUG(0, ("server DISCONNECT event\n"));
- ctx->state = IBWS_STOPPED; /* ??? TODO: try it... */
- /* talloc_free(ctx) should be called within or after this func */
- pctx->connstate_func(ctx, NULL);
}
break;
@@ -894,9 +883,11 @@
int ibw_stop(struct ibw_ctx *ctx)
{
+ struct ibw_ctx_priv *pctx = (struct ibw_ctx_priv *)ctx->internal;
struct ibw_conn *p;
DEBUG(10, ("ibw_stop\n"));
+
for(p=ctx->conn_list; p!=NULL; p=p->next) {
if (ctx->state==IBWC_ERROR || ctx->state==IBWC_CONNECTED) {
if (ibw_disconnect(p))
@@ -904,6 +895,9 @@
}
}
+ ctx->state = IBWS_STOPPED;
+ pctx->connstate_func(ctx, NULL);
+
return 0;
}
@@ -1003,20 +997,17 @@
int ibw_disconnect(struct ibw_conn *conn)
{
int rc;
- struct ibw_ctx_priv *pctx = talloc_get_type(conn->ctx->internal, struct ibw_ctx_priv);
struct ibw_conn_priv *pconn = talloc_get_type(conn->internal, struct ibw_conn_priv);
DEBUG(10, ("ibw_disconnect: cmid=%p\n", pconn->cm_id));
- rc = rdma_disconnect(pctx->cm_id);
+ rc = rdma_disconnect(pconn->cm_id);
if (rc) {
sprintf(ibw_lasterr, "ibw_disconnect failed with %d", rc);
DEBUG(0, (ibw_lasterr));
return rc;
}
- /* continued at RDMA_CM_EVENT_DISCONNECTED */
-
return 0;
}
@@ -1092,7 +1083,7 @@
*((uint32_t *)buf) = htonl(len);
/* can we send it right now? */
- if (pconn->wr_sent<=pctx->opts.max_send_wr) {
+ if (pconn->wr_sent<pctx->opts.max_send_wr) {
struct ibv_sge list = {
.addr = (uintptr_t) NULL,
.length = len,
=== modified file 'tests/ibwrapper_test.c'
--- a/tests/ibwrapper_test.c 2007-01-30 17:47:26 +0000
+++ b/tests/ibwrapper_test.c 2007-02-01 17:46:44 +0000
@@ -59,6 +59,7 @@
int nmsg; /* number of messages to send (client) */
int kill_me;
+ int stopping;
int error;
struct ibw_ctx *ibwctx;
@@ -187,8 +188,6 @@
break;
case IBWS_STOPPED:
DEBUG(10, ("test IBWS_STOPPED\n"));
- talloc_free(tcx->ibwctx);
- DEBUG(10, ("talloc_free(tcx->ibwctx) DONE\n"));
tcx->kill_me = 1; /* main loop can exit */
break;
case IBWS_ERROR:
@@ -263,8 +262,10 @@
char msg[26];
sprintf(msg, "hello world %d", tcx->nmsg--);
tcx->error = ibwtest_send_test_msg(tcx, conn, msg);
- if (tcx->nmsg==0)
- tcx->kill_me = 1;
+ if (tcx->nmsg==0) {
+ ibw_stop(tcx->ibwctx);
+ tcx->stopping = 1;
+ }
}
}
@@ -294,11 +295,18 @@
static struct ibwtest_ctx *testctx = NULL;
-void ibwtest_sigquit_handler(int sig)
+void ibwtest_sigint_handler(int sig)
{
- DEBUG(0, ("got SIGQUIT\n"));
- if (testctx)
- ibw_stop(testctx->ibwctx);
+ DEBUG(0, ("got SIGINT\n"));
+ if (testctx) {
+ if (testctx->stopping) {
+ DEBUG(10, ("forcing exit...\n"));
+ testctx->kill_me = 1;
+ } else {
+ ibw_stop(testctx->ibwctx);
+ testctx->stopping = 1;
+ }
+ }
}
int ibwtest_parse_attrs(struct ibwtest_ctx *tcx, char *optext,
@@ -418,7 +426,7 @@
/* here is the only case we can't avoid using global... */
testctx = tcx;
- signal(SIGQUIT, ibwtest_sigquit_handler);
+ signal(SIGINT, ibwtest_sigint_handler);
while ((op=getopt(argc, argv, "i:o:d:m:st:n:l:")) != -1) {
switch (op) {
More information about the samba-cvs
mailing list