Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: w@1wt.eu
Cc: netdev@vger.kernel.org, weiwan@google.com, ycheng@google.com,
	edumazet@google.com
Subject: Re: [PATCH net-next] net/tcp-fastopen: make connect()'s return case more consistent with non-TFO
Date: Wed, 25 Jan 2017 14:12:32 -0500 (EST)	[thread overview]
Message-ID: <20170125.141232.611265798570382143.davem@davemloft.net> (raw)
In-Reply-To: <1485351766-17124-1-git-send-email-w@1wt.eu>

From: Willy Tarreau <w@1wt.eu>
Date: Wed, 25 Jan 2017 14:42:46 +0100

> Without TFO, any subsequent connect() call after a successful one returns
> -1 EISCONN. The last API update ensured that __inet_stream_connect() can
> return -1 EINPROGRESS in response to sendmsg() when TFO is in use to
> indicate that the connection is now in progress. Unfortunately since this
> function is used both for connect() and sendmsg(), it has the undesired
> side effect of making connect() now return -1 EINPROGRESS as well after
> a successful call, while at the same time poll() returns POLLOUT. This
> can confuse some applications which happen to call connect() and to
> check for -1 EISCONN to ensure the connection is usable, and for which
> EINPROGRESS indicates a need to poll, causing a loop.
> 
> This problem was encountered in haproxy where a call to connect() is
> precisely used in certain cases to confirm a connection's readiness.
> While arguably haproxy's behaviour should be improved here, it seems
> important to aim at a more robust behaviour when the goal of the new
> API is to make it easier to implement TFO in existing applications.
> 
> This patch simply ensures that we preserve the same semantics as in
> the non-TFO case on the connect() syscall when using TFO, while still
> returning -1 EINPROGRESS on sendmsg(). For this we simply tell
> __inet_stream_connect() whether we're doing a regular connect() or in
> fact connecting for a sendmsg() call.
> 
> Cc: Wei Wang <weiwan@google.com>
> Cc: Yuchung Cheng <ycheng@google.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Willy Tarreau <w@1wt.eu>

Applied.

           reply	other threads:[~2017-01-25 19:12 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1485351766-17124-1-git-send-email-w@1wt.eu>]

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=20170125.141232.611265798570382143.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=w@1wt.eu \
    --cc=weiwan@google.com \
    --cc=ycheng@google.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