From: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: Animesh K Trivedi1 <ATR-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org>
Cc: Bernard Metzler <BMT-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: fixing blocking rdma_connect call on failure
Date: Tue, 28 Sep 2010 09:55:51 -0500 [thread overview]
Message-ID: <4CA201F7.8010403@opengridcomputing.com> (raw)
In-Reply-To: <OFD1E009D6.AB14F4A6-ONC12577AC.00485D02-C12577AC.0050EF83-Xeyd2O9EBijQT0dZR+AlfA@public.gmane.org>
On 09/28/2010 09:44 AM, Animesh K Trivedi1 wrote:
> Hi,
>
> Below is a short patch to eliminate an uninterruptible indefinite wait in
> kernel while destroying the cm_id when iw_cm_connect(...) fails.
>
> It happens when creation of a protection domain fails but user, without
> checking the return value, continues with an attempt to connect to the
> server. In the call iw_cm_connect(...) it retrieves a NULL qp from the
> device and fails, but does not clear the IWCM_F_CONNECT_WAIT bit. In
> destroy_cm_id(...) it waits on clearance of IWCM_F_CONNECT_WAIT bit which
> never happens.
>
> Same goes with the accept call.
>
> I am not on the list, so please cc me for the comments and changes.
>
> Thanks,
> --
> Animesh
>
>
>
> Signed-off-by: Animesh Trivedi<atr-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org>
>
> diff --git a/drivers/infiniband/core/iwcm.c
> b/drivers/infiniband/core/iwcm.c
> index bfead5b..2a1e9ae 100644
> --- a/drivers/infiniband/core/iwcm.c
> +++ b/drivers/infiniband/core/iwcm.c
> @@ -506,6 +506,8 @@ int iw_cm_accept(struct iw_cm_id *cm_id,
> qp = cm_id->device->iwcm->get_qp(cm_id->device, iw_param->qpn);
> if (!qp) {
> spin_unlock_irqrestore(&cm_id_priv->lock, flags);
> + clear_bit(IWCM_F_CONNECT_WAIT,&cm_id_priv->flags);
> + wake_up_all(&cm_id_priv->connect_wait);
> return -EINVAL;
> }
> cm_id->device->iwcm->add_ref(qp);
> @@ -565,6 +567,8 @@ int iw_cm_connect(struct iw_cm_id *cm_id, struct
> iw_cm_conn_param *iw_param)
> qp = cm_id->device->iwcm->get_qp(cm_id->device, iw_param->qpn);
> if (!qp) {
> spin_unlock_irqrestore(&cm_id_priv->lock, flags);
> + clear_bit(IWCM_F_CONNECT_WAIT,&cm_id_priv->flags);
> + wake_up_all(&cm_id_priv->connect_wait);
> return -EINVAL;
> }
> cm_id->device->iwcm->add_ref(qp);
>
>
Looks good to me.
Steve.
--
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
next prev parent reply other threads:[~2010-09-28 14:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 14:44 fixing blocking rdma_connect call on failure Animesh K Trivedi1
[not found] ` <OFD1E009D6.AB14F4A6-ONC12577AC.00485D02-C12577AC.0050EF83-Xeyd2O9EBijQT0dZR+AlfA@public.gmane.org>
2010-09-28 14:55 ` Steve Wise [this message]
2010-10-12 3:25 ` Roland Dreier
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=4CA201F7.8010403@opengridcomputing.com \
--to=swise-7bpotxp6k4+p2yhjcf5u+vpxobypeauw@public.gmane.org \
--cc=ATR-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org \
--cc=BMT-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.