All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Malat <oss@malat.biz>
To: linux-sctp@vger.kernel.org
Subject: Re: [PATCH net] sctp: Free connecting association if there is a pending signal
Date: Thu, 12 Jul 2018 10:27:54 +0000	[thread overview]
Message-ID: <20180712102733.i7p6sigw7yqojrq3@ntb.petris.klfree.czf> (raw)
In-Reply-To: <20180709101142.GA1820@bordel.klfree.net>

On Wed, Jul 11, 2018 at 07:43:39PM -0400, Neil Horman wrote:
> > > > $ ./a.out | ts "%H:%M:%S" # Empty lines added for readability
> > > > 10:45:46 Testing IPPROTO_SCTP on a blocking socket
> > > > 10:45:49   1st connect - rtn: -1 errno: 114 (Operation already in progress)
> > > > 10:45:49   2nd connect - rtn: -1 errno: 114 (Operation already in progress)
> > > > 10:45:49 Testing IPPROTO_TCP on a blocking socket
> > > > 10:46:52   1st connect - rtn: -1 errno: 110 (Connection timed out)
> > > > 10:47:55   2nd connect - rtn: -1 errno: 110 (Connection timed out)
> > > > 
> > > This is the origional case, and I agree that it seems like SCTP is acting as a
> > > non-blocking socket here (I presume it returns EINPROGRESS immediately, rather
> > > than after some timeout value)?
> > It returns after a signal is handled - in my test the signal is
> > generated by alarm, but it doesn't matter what is the source of
> > the signal.
> > The blocking socket can be easilly identified by the return value
> > from sock_intr_errno, which is ERESTARTSYS for a blocking operation
> > and EINTR for a non-blocking one.
> > I can change my patch to free the association only if ERESTARTSYS
> > is returned. What do you think about it?
> No, I don't think we should be freeing the association without taking direction
> from user space here, as I noted before.  
How else it could be fixed then? I think freeing the association is the
only possible option on blocking sockets, as applications using blocking
sockets do not expect the connection attempt to continue on the 
background.
Theoretically, it could be optimized to free the association only if
SA_RESTART is not enabled on that socket and try to pick it and restore
waiting in the other case.
  Petr

      parent reply	other threads:[~2018-07-12 10:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 10:11 [PATCH net] sctp: Free connecting association if there is a pending signal Petr Malat
2018-07-09 12:15 ` Neil Horman
2018-07-09 15:37 ` Petr Malat
2018-07-09 19:08 ` Neil Horman
2018-07-11  9:12 ` Petr Malat
2018-07-11 10:43 ` Neil Horman
2018-07-11 11:09 ` David Laight
2018-07-11 17:20 ` Petr Malat
2018-07-11 23:43 ` Neil Horman
2018-07-12 10:27 ` Petr Malat [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=20180712102733.i7p6sigw7yqojrq3@ntb.petris.klfree.czf \
    --to=oss@malat.biz \
    --cc=linux-sctp@vger.kernel.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.