From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [Bug 106241] New: shutdown(3)/close(3) behaviour is incorrect for sockets in accept(3) Date: Sat, 31 Oct 2015 21:51:16 +0000 Message-ID: <20151031215116.GO22011@ZenIV.linux.org.uk> References: <20151030210215.GI22011@ZenIV.linux.org.uk> <20151030223317.GK22011@ZenIV.linux.org.uk> <20151031193449.GM22011@ZenIV.linux.org.uk> <1446324359.6254.71.camel@edumazet-glaptop2.roam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Eric Dumazet , David Miller , Stephen Hemminger , Network Development , David Howells , linux-fsdevel To: Linus Torvalds Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Sat, Oct 31, 2015 at 02:23:31PM -0700, Linus Torvalds wrote: > The other stuff we probably can't do all that much about. Unless we > decide to go for some complicated lockless optimistic file descriptor > allocation scheme with retry-on-failure instead of locks. Which I'm > sure is possible, but I'm equally sure is painful. The interesting part is dup2() - we'd have to do something like serialize against other dup2 was_claimed = atomically set and test bit in bitmap if was_claimed tofree = fdt->fd[fd]; if (!tofree) fail with EBUSY install into ->fd[...] end of critical area in there; __alloc_fd() could be made retry-on-failure, but I don't see how to cope with dup2 vs. dup2 without an explicit exclusion.