netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Friesen <chris.friesen@genband.com>
To: netdev <netdev@vger.kernel.org>,
	ying.xue@windriver.com,
	Allan Stephens <allan.stephens@windriver.com>,
	Jon Maloy <jon.maloy@ericsson.com>
Subject: [BUG]  TIPC handling of -ERESTARTSYS in connect()
Date: Thu, 30 Aug 2012 09:20:47 -0600	[thread overview]
Message-ID: <503F84CF.208@genband.com> (raw)


Hi,

I'm seeing some behaviour that looks unintentional in the TIPC connect() call.
I'm running TIPC 1.7.7.  My userspace code (stripped of error handling) looks
like this:

	int sd = socket (AF_TIPC, SOCK_SEQPACKET,0);
	connect(sd,(struct sockaddr*)&topsrv,sizeof(topsrv));

where topsrv is the address of the TIPC topology server.  The thing that's weird
is that intermittently we get a EISCONN error on the connect call.

Looking at the TIPC connect() code, I think what is happening is that
wait_event_interruptible_timeout() is being interrupted by a signal and returns
-ERESTARTSYS.  This sets sock->state to SS_DISCONNECTING and exits.  Userspace
sees the ERESTARTSYS and retries the syscall, then we hit the
"sock->state != SS_UNCONNECTED" check and exit with -EISCONN.

I think current mainline is susceptible to this as well.

I'm not sure what the proper fix would be--can we detect coming back in that we were
waiting for a message and just skip down to the wait_event_interruptible_timeout()
call?

Chris


-- 

Chris Friesen
Software Designer

3500 Carling Avenue
Ottawa, Ontario K2H 8E9
www.genband.com

             reply	other threads:[~2012-08-30 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30 15:20 Chris Friesen [this message]
2012-08-31  9:37 ` [BUG] TIPC handling of -ERESTARTSYS in connect() Ying Xue
2012-08-31 15:09   ` Chris Friesen
2012-08-31 15:18     ` Chris Friesen
2012-09-03  3:16       ` Ying Xue
2012-09-04 14:54         ` Chris Friesen
2012-10-31 23:01           ` Chris Friesen
2012-11-01  6:35             ` Xue Ying

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=503F84CF.208@genband.com \
    --to=chris.friesen@genband.com \
    --cc=allan.stephens@windriver.com \
    --cc=jon.maloy@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=ying.xue@windriver.com \
    /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;
as well as URLs for NNTP newsgroup(s).