public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Sreedhar Kodali <srkodali-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] rsockets: Support calling listen multiple times on same rsocket
Date: Fri, 05 Sep 2014 19:44:28 +0530	[thread overview]
Message-ID: <49c81161bb7eff0af392e495728f3b08@imap.linux.ibm.com> (raw)
In-Reply-To: <1409855909-28819-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On 2014-09-05 00:08, sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> Standard sockets allows an application to call listen() multiple
> times on the same socket without error.  This allows a multi-threaded
> app to call listen from all threads.
> 
> rsockets will fail the second listen call.  Modify the behavior to
> match standard sockets.
> 
> Problem reported by: Sreedhar Kodali <srkodali-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> 
> Signed-off-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  src/rsocket.c |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/rsocket.c b/src/rsocket.c
> index 00d9a18..4833810 100644
> --- a/src/rsocket.c
> +++ b/src/rsocket.c
> @@ -1174,9 +1174,14 @@ int rlisten(int socket, int backlog)
>  	rs = idm_lookup(&idm, socket);
>  	if (!rs)
>  		return ERR(EBADF);
> -	ret = rdma_listen(rs->cm_id, backlog);
> -	if (!ret)
> -		rs->state = rs_listening;
> +
> +	if (rs->state != rs_listening) {
> +		ret = rdma_listen(rs->cm_id, backlog);
> +		if (!ret)
> +			rs->state = rs_listening;
> +	} else {
> +		ret = 0;
> +	}
>  	return ret;
>  }

Hi Sean,

This patch is working fine.

Thank You.

- Sreedhar

--
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

      parent reply	other threads:[~2014-09-05 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 18:38 [PATCH] rsockets: Support calling listen multiple times on same rsocket sean.hefty-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <1409855909-28819-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-05 14:14   ` Sreedhar Kodali [this message]

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=49c81161bb7eff0af392e495728f3b08@imap.linux.ibm.com \
    --to=srkodali-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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