rping: Fixes race, where ibv context was getting freed before memory was deregistered
authorHariprasad S <hariprasad@chelsio.com>
Thu, 6 Nov 2014 09:12:56 +0000 (14:42 +0530)
committerSean Hefty <sean.hefty@intel.com>
Fri, 14 Nov 2014 18:47:24 +0000 (10:47 -0800)
While running rping as a client without server on the other end,
rping_test_client fails and the ibv context was getting freed
before memory was deregistered. This patch fixes it.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
examples/rping.c

index 949cbe6..f0414de 100644 (file)
@@ -1055,18 +1055,19 @@ static int rping_run_client(struct rping_cb *cb)
        ret = rping_connect_client(cb);
        if (ret) {
                fprintf(stderr, "connect error %d\n", ret);
-               goto err2;
+               goto err3;
        }
 
        ret = rping_test_client(cb);
        if (ret) {
                fprintf(stderr, "rping client failed: %d\n", ret);
-               goto err3;
+               goto err4;
        }
 
        ret = 0;
-err3:
+err4:
        rdma_disconnect(cb->cm_id);
+err3:
        pthread_join(cb->cqthread, NULL);
 err2:
        rping_free_buffers(cb);