RE: RDMA_CM_EVENT_REJECTED and ressources release

Hefty, Sean
2012-06-21T16:04:23Z

> - call rdma_disconnect(): even if the connection is not established,
> rdma_disconnect() can be called.
>
> In this case, all receive WR posted came back in error.

On processing a reject event, the librdmacm should transition the QP into the error state. That should flush all posted work requests. At that point, you should only need to pull off the failed WRs from the CQ, then destroy everything.

> - call rdma_destroy_qp(), ibv_destroy_cq(), ibv_dereg_mr(), and
> rdma_destroy_id().
>
> Before calling ibv_destroy_cq(), the program call ibv_poll_cq() to
> flush the CQ (but the function return -2 when called on the CQ used
> to hold receive WC, but without problem on the one used to hold send
> WC)

I have no idea what the -2 return code is indicating or why it occurs. But try polling the CQ before attempting to destroy the QP.

- Sean