[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1445513425.22974.100.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 22 Oct 2015 04:30:25 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Casper.Dik@...cle.com
Cc: Alan Burlison <Alan.Burlison@...cle.com>,
David Miller <davem@...emloft.net>, viro@...IV.linux.org.uk,
stephen@...workplumber.org, netdev@...r.kernel.org,
dholland-tech@...bsd.org
Subject: Re: [Bug 106241] New: shutdown(3)/close(3) behaviour is incorrect
for sockets in accept(3)
On Thu, 2015-10-22 at 08:15 +0200, Casper.Dik@...cle.com wrote:
> >It's been said that the current mechanisms in Linux & some BSD variants
> >can be subject to races, and the behaviour exhibited doesn't conform to
> >POSIX, for example requiring the use of shutdown() on unconnected
> >sockets because close() doesn't kick off other threads accept()ing on
> >the same fd. I'd be interested to hear if there's a better and more
> >performant way of handling the situation that doesn't involve doing the
> >sort of bookkeeping Casper described,.
>
> Of course, the implementation is now around 18 years old; clearly a lot of
> things have changed since then.
>
> In the particular case of Linux close() on a socket, surely it must be
> possible to detect at close that it is a listening socket and that you are
> about to close the last reference; the kernel could then do the shutdown()
> all by itself.
We absolutely do not _want_ to do this just so that linux becomes slower
to the point Solaris can compete, or you guys can avoid some work.
close(fd) is very far from knowing a file is a 'listener' or even a
'socket' without extra cache line misses.
To force a close of an accept() or whatever blocking socket related
system call a shutdown() makes a lot of sense.
This would have zero additional overhead for the fast path.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists