public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Rainer Weikusat <rweikusat@mobileactivedefense•com>
To: Eric Dumazet <eric.dumazet@gmail•com>
Cc: David Miller <davem@davemloft•net>,
	David.Laight@ACULAB•COM, netdev@vger•kernel.org
Subject: Re: [PATCH] net: unix: non blocking recvmsg() should not return -EINTR
Date: Wed, 26 Mar 2014 22:06:49 +0000	[thread overview]
Message-ID: <8761n07gxy.fsf@sable.mobileactivedefense.com> (raw)
In-Reply-To: <1395870280.12610.252.camel@edumazet-glaptop2.roam.corp.google.com> (Eric Dumazet's message of "Wed, 26 Mar 2014 14:44:40 -0700")

Eric Dumazet <eric.dumazet@gmail•com> writes:
> On Wed, 2014-03-26 at 21:21 +0000, Rainer Weikusat wrote:
>> BTW, here's the program with the O_NONBLOCK read call which blocks until
>> the end of electricity, at least on 3.2.9:
>> 
>> ---------
>> #include <fcntl.h>
>> #include <string.h>
>> #include <sys/socket.h>
>> #include <sys/un.h>
>> 
>> int main(void)
>> {
>>     struct sockaddr_un sun;
>>     int fd;
>> 
>>     fd = socket(AF_UNIX, SOCK_DGRAM, 0);
>>     sun.sun_family = AF_UNIX;
>>     strncpy(sun.sun_path, "/tmp/bla", sizeof(sun.sun_path));
>>     bind(fd, (struct sockaddr *)&sun, sizeof(sun));
>> 
>>     if (fork() == 0) read(fd, &fd, sizeof(fd));
>> 
>>     sleep(1);
>> 
>>     fcntl(fd, F_SETFL, O_NONBLOCK);
>>     read(fd, &fd, sizeof(fd));
>> 
>>     return 0;
>> }
>
> Sure, O_NONBLOCK is translated into MSG_NOWAIT one time per socket
> syscall. 
>
> Once we block, we don't automatically unblock if another thread change
> the file flag.

That would be a seriously bizarre idea. The thread of execution which
does the supposed-to-be-non-blocking call shouldn't become blocked for
an indefinite time. Which means it should not wait indefinitely for a
thread which - in turn - waits indefinitely for an external event (and
hence, the original problem should never have existed to begin with as
there would neither be an opportunity nor a reason to interrupt in the
non-blocking case).

BTW, while these are things which are of some interest to me (even of
some professional interest), I don't exactly get paid for these kind of
discussions, have some real work to do, and the way people interact on
LKML is seriously more aggressive then I can stand for a prolonged time,
so can we please end this discussion here while it - if only for a
change - hasn't yet degraded into an all out mutual extermination fight?

  reply	other threads:[~2014-03-26 22:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26  1:42 [PATCH] net: unix: non blocking recvmsg() should not return -EINTR Eric Dumazet
2014-03-26 13:17 ` Rainer Weikusat
2014-03-26 13:57   ` Rainer Weikusat
2014-03-26 14:09   ` Eric Dumazet
2014-03-26 14:25     ` Rainer Weikusat
2014-03-26 15:00 ` David Laight
2014-03-26 15:13   ` Rainer Weikusat
2014-03-26 15:25     ` Eric Dumazet
2014-03-26 15:33       ` Eric Dumazet
2014-03-26 19:46       ` Rainer Weikusat
2014-03-26 21:04         ` Rainer Weikusat
2014-03-27  9:36           ` David Laight
2014-03-27 12:40             ` Rainer Weikusat
2014-03-27 12:49               ` Jamal Hadi Salim
2014-03-27 13:02                 ` Rainer Weikusat
2014-03-27 12:53               ` David Laight
2014-03-27 13:29                 ` Rainer Weikusat
2014-03-26 21:05         ` David Miller
2014-03-26 21:21           ` Rainer Weikusat
2014-03-26 21:44             ` Eric Dumazet
2014-03-26 22:06               ` Rainer Weikusat [this message]
2014-03-26 22:35                 ` Eric Dumazet
2014-03-26 22:51                   ` Rainer Weikusat
2014-03-26 22:58                     ` Eric Dumazet
2014-03-28 20:35             ` Rainer Weikusat

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=8761n07gxy.fsf@sable.mobileactivedefense.com \
    --to=rweikusat@mobileactivedefense$(echo .)com \
    --cc=David.Laight@ACULAB$(echo .)COM \
    --cc=davem@davemloft$(echo .)net \
    --cc=eric.dumazet@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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