This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC][BZ #14627] Make linux close errno to EINPROGRESS when interrupted in signal.
- From: Rich Felker <dalias at aerifal dot cx>
- To: Christoph Hellwig <hch at lst dot de>
- Cc: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org
- Date: Thu, 5 Dec 2013 15:11:26 -0500
- Subject: Re: [RFC][BZ #14627] Make linux close errno to EINPROGRESS when interrupted in signal.
- Authentication-results: sourceware.org; auth=none
- References: <20131205171054 dot GA14905 at domone dot podge> <52A0B6B5 dot 1010605 at linux dot vnet dot ibm dot com> <20131205175749 dot GL24286 at brightrain dot aerifal dot cx> <20131205195802 dot GA19289 at lst dot de>
On Thu, Dec 05, 2013 at 08:58:02PM +0100, Christoph Hellwig wrote:
> On Thu, Dec 05, 2013 at 12:57:49PM -0500, Rich Felker wrote:
> > Note that, for the most part, close on Linux does not return EINTR.
> > The only way it can happen is with certain devices (for testing this
> > issue, I had someone helping me test it write a kernel module for a
> > fake device that always blocks in close and returns EINTR when
> > interrupted) and perhaps custom filesystems. So a change here will not
> > impact most applications.
>
> Returning EINTR in Linux is incredibly hard. While the normal ->release
> method that is called on drop of the final reference to a file does return
> an error, it is explicitly ignored.
>
> A filesystem or character device driver would have to implement the
> special ->flush method that is called on every close method to be able
> to return an error, and returning EINTR from that is discouraged. I
> wouldn't mind adding a check to enforce that either.
If EINTR from close essentially doesn't show up in the wild on Linux,
I think the proposed change in glibc to replace it with EINPROGRESS
would essentially be just a safety against (dangerous!) double-close
bugs in correct POSIX applications due to strange devices slipping an
EINTR through. I'm still strongly in favor of adding it (or a
replacement with 0/success).
Rich