public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iw_cm: Call provider listen_destroy function before changing state.
@ 2012-02-22 19:43 Steve Wise
       [not found] ` <20120222194337.21025.30754.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Steve Wise @ 2012-02-22 19:43 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A, sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

When destroying a listening cmid, the iwcm first sets the cmid state to
DESTROYING, then releases the lock and calls into the iwarp provider
to destroy the listening endpoint.  Since the cmid is not locked, its
possible for the iwarp provider to pass a connection request event to
the iwcm before the provider has destroyed the listening endpoint. This
connect request will be silently dropped by the iwcm because the state
of the cmid is DESTROYING.  The iwarp provider, however, doesn't know the
connect request was dropped.  This causes the iwarp provider to never free
up the resources from this connection because the assumption is the iwcm
will _always_ either accept or reject this connection.  The solution is
to only change the cmid state  after the iwarp provider has destroyed its
listening endpoint, and thus no more connection requests will be posted.

Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---

 drivers/infiniband/core/iwcm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index 1a696f7..3b43bba 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -340,11 +340,11 @@ static void destroy_cm_id(struct iw_cm_id *cm_id)
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
 	switch (cm_id_priv->state) {
 	case IW_CM_STATE_LISTEN:
-		cm_id_priv->state = IW_CM_STATE_DESTROYING;
 		spin_unlock_irqrestore(&cm_id_priv->lock, flags);
 		/* destroy the listening endpoint */
 		ret = cm_id->device->iwcm->destroy_listen(cm_id);
 		spin_lock_irqsave(&cm_id_priv->lock, flags);
+		cm_id_priv->state = IW_CM_STATE_DESTROYING;
 		break;
 	case IW_CM_STATE_ESTABLISHED:
 		cm_id_priv->state = IW_CM_STATE_DESTROYING;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-02-22 21:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-22 19:43 [PATCH] iw_cm: Call provider listen_destroy function before changing state Steve Wise
     [not found] ` <20120222194337.21025.30754.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
2012-02-22 19:50   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A82373374F1119-P5GAC/sN6hlcIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-02-22 20:02       ` Steve Wise
     [not found]         ` <4F4549E9.3090102-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2012-02-22 20:20           ` Steve Wise
2012-02-22 20:32   ` Roland Dreier
     [not found]     ` <CAG4TOxMXTzLDynza4KOaccx2C+Nn0485Xk_hXgg_bG0CiCTSEQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-22 20:43       ` Steve Wise
     [not found]         ` <4F45536A.3050501-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2012-02-22 21:01           ` Steve Wise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox