RDMA/iw_cxgb4: move QP -> ERROR on fatal disconnect errors
authorHariprasad S <hariprasad@chelsio.com>
Wed, 4 May 2016 19:57:36 +0000 (01:27 +0530)
committerDoug Ledford <dledford@redhat.com>
Thu, 5 May 2016 20:11:14 +0000 (16:11 -0400)
In c4iw_ep_disconnect(), if we fail to initiate a close operation, then
move the qp to ERROR to disassociate the ep from the qp.  Failure to do
this will leak the ep resources.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/cxgb4/cm.c

index 44e0bc409d59d2da36330ae8582301fbbef03bed..aea69ca495f38d5ad809a3dcb61533135e7e3cf1 100644 (file)
@@ -3509,6 +3509,19 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
                                stop_ep_timer(ep);
                                close_complete_upcall(ep, -EIO);
                        }
+                       if (ep->com.qp) {
+                               struct c4iw_qp_attributes attrs;
+
+                               attrs.next_state = C4IW_QP_STATE_ERROR;
+                               ret = c4iw_modify_qp(ep->com.qp->rhp,
+                                                    ep->com.qp,
+                                                    C4IW_QP_ATTR_NEXT_STATE,
+                                                    &attrs, 1);
+                               if (ret)
+                                       pr_err(MOD
+                                              "%s - qp <- error failed!\n",
+                                              __func__);
+                       }
                        fatal = 1;
                }
        }