public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] iw_cm: Call provider listen_destroy function before changing state.
Date: Wed, 22 Feb 2012 13:43:38 -0600	[thread overview]
Message-ID: <20120222194337.21025.30754.stgit@build.ogc.int> (raw)

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

             reply	other threads:[~2012-02-22 19:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-22 19:43 Steve Wise [this message]
     [not found] ` <20120222194337.21025.30754.stgit-T4OLL4TyM9aNDNWfRnPdfg@public.gmane.org>
2012-02-22 19:50   ` [PATCH] iw_cm: Call provider listen_destroy function before changing state 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120222194337.21025.30754.stgit@build.ogc.int \
    --to=swise-7bpotxp6k4+p2yhjcf5u+vpxobypeauw@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox