netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ying Xue <ying.xue@windriver.com>
To: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Erik Hugne <erik.hugne@ericsson.com>, <netdev@vger.kernel.org>,
	<jon.maloy@ericsson.com>, <tipc-discussion@lists.sourceforge.net>,
	<nhan.tt.vo@dektech.com.au>
Subject: Re: [PATCH] tipc: set sk_err correctly when connection fails
Date: Wed, 28 Aug 2013 09:32:05 +0800	[thread overview]
Message-ID: <521D5315.9060608@windriver.com> (raw)
In-Reply-To: <521CEBF7.4040103@windriver.com>

On 08/28/2013 02:12 AM, Paul Gortmaker wrote:
> On 13-08-27 11:18 AM, Erik Hugne wrote:
>> On Tue, Aug 27, 2013 at 09:20:23AM -0400, Paul Gortmaker wrote:
>>> What was the high level user visible symptom in this case?
>>> Stalled connections or ... ?
>>
>> Should the connect fail, if the publication/server is unavailable or some other
>> error. The connect() call returns the error code directly (as a positive value).
> 
> Please send a v2 with the end-user visible symptom clearly described;
> as this information is what people use in order to triage whether
> commits belong in stable, or net vs. net-next etc.   For example:
> 
>   Should the connect fail, say if the publication/server is unavailable or
>   some other error, then the code returns a positive return value.  Since
>   most code only checks for a negative return on connect(), it tries to
>   continue, but will ultimately fail on the 1st sendto() as the strace
>   snippet below shows.
> 
> I've said "most code" since I simply don't know what it was that you were
> tracing below.  It would help if we knew if this part of a common application
> or similar.
> 

Firstly it's absolutely wrong that connect() returns a positive error
code - 111(i.e, ECONNREFUSED) if connect() is failed, that is, it
violates POSIX standard.

As the patch's changelog describes, sk_err is incorrectly set to a
negative value instead of positive value in filter_connect(). In
connect(), it will set its return value with sock_error(sk) if it fails.
As the return value of sock_error(sk) almost can be deemed as -sk_err,
this is why we see a positive error code of connect() in below strace log.

But, the patch is absolutely able to fix the issue.

Regards,
Ying

> Thanks,
> Paul.
> --
> 
>>
>> [...]
>> socket(0x1e /* PF_??? */, SOCK_SEQPACKET, 0) = 3
>> setsockopt(3, 0x10f /* SOL_?? */, 129, [0], 4) = 0
>> setsockopt(3, 0x10f /* SOL_?? */, 127, [0], 4) = 0
>> connect(3, {sa_family=0x1e /* AF_??? */, sa_data="\2\1\322\4\0\0\322\4\0\0\0\0\0\0"}, 16) = 111
>> sendto(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 66000, 0, NULL, 0) = -1 EPIPE (Broken pipe)
>>
>> In the strace above, error checking was done as:
>> if (connect(fd,.....) < 0)
>>     perror("connect");
>>
>> //E
>>
> 
> 

      reply	other threads:[~2013-08-28  1:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 13:56 [PATCH] tipc: set sk_err correctly when connection fails erik.hugne
2013-08-27  0:45 ` Ying Xue
2013-08-27 13:20 ` Paul Gortmaker
2013-08-27 15:18   ` Erik Hugne
2013-08-27 18:12     ` Paul Gortmaker
2013-08-28  1:32       ` Ying Xue [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=521D5315.9060608@windriver.com \
    --to=ying.xue@windriver.com \
    --cc=erik.hugne@ericsson.com \
    --cc=jon.maloy@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhan.tt.vo@dektech.com.au \
    --cc=paul.gortmaker@windriver.com \
    --cc=tipc-discussion@lists.sourceforge.net \
    /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).