All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
To: Bryan Green <bryan.d.green-NSQ8wuThN14@public.gmane.org>
Cc: "Hefty,
	Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: librdmacm: select() gives false positive on cm channel file descriptor
Date: Thu, 03 Jun 2010 11:44:35 -0700	[thread overview]
Message-ID: <adask54ot0s.fsf@roland-alpha.cisco.com> (raw)
In-Reply-To: <20100603183338.229F222BCB-PJ7uzvdTSdjyYnqMeUxRc+1ftBKYq+Ku@public.gmane.org> (Bryan Green's message of "Thu, 03 Jun 2010 11:33:38 -0700")

This looks a little suspicious:

 >     nfds = fds;
 >     res = select(fdcnt, &nfds, 0, 0, 0);
 >     if (res == -1) {
 >         perror("select");
 >         return -1;
 >     }
 > 
 >     if (FD_ISSET(cb->cm_channel->fd, &fds)) {
 >         // got a disconnect event?

you set nfds to fds, pass &nfds into select() and then check if the
cm_channel fd is set in the original fds.  Seems wrong to me.

Not sure why you need two fd_set variables anyway.  (And IMHO select()
is obsolete and should never be used ... poll() is a better interface in
every way, and if you can take a bit more complexity epoll is better still)

 - R.
-- 
Roland Dreier <rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
--
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:[~2010-06-03 18:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02  0:04 librdmacm: select() gives false positive on cm channel file descriptor Bryan Green
     [not found] ` <20100602000456.A4C10225DA-PJ7uzvdTSdjyYnqMeUxRc+1ftBKYq+Ku@public.gmane.org>
2010-06-03 16:06   ` Hefty, Sean
     [not found]     ` <CF9C39F99A89134C9CF9C4CCB68B8DDF255F4634BE-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-06-03 18:33       ` Bryan Green
     [not found]         ` <20100603183338.229F222BCB-PJ7uzvdTSdjyYnqMeUxRc+1ftBKYq+Ku@public.gmane.org>
2010-06-03 18:44           ` Roland Dreier [this message]
     [not found]             ` <adask54ot0s.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-06-03 19:06               ` Bryan Green
     [not found]                 ` <20100603190651.188C02270E-PJ7uzvdTSdjyYnqMeUxRc+1ftBKYq+Ku@public.gmane.org>
2010-06-03 19:31                   ` 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=adask54ot0s.fsf@roland-alpha.cisco.com \
    --to=rdreier-fyb4gu1cfyuavxtiumwx3w@public.gmane.org \
    --cc=bryan.d.green-NSQ8wuThN14@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 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.