freebsd-dev/sys/fs
Konstantin Belousov 1d48f121d8 Ensure that when a blockable open of fifo returns success, a valid
file descriptor opened for complimentary access exists as well.

The implementation of the guarantee is done by counting the
generations of readers and writers opens.  We return success and not
EINTR or ERESTART error, when the sleep for complimentary opening is
interrupted, but the generation was changed during the sleep.

Longer explanation: assume there are two threads, A doing open("fifo",
O_RDONLY) and B doing open("fifo", O_WRONLY), and no other threads
either trying to open the fifo, nor there are any file descriptors
referencing the fifo.  Before the change, it was possible e.g. for for
thread A to return a valid file descriptor, while thread B returned
EINTR if a signal to B was delivered simultaneously with the wakeup
from A.  After the change, in this situation both A::open() and
B::open() succeed and the signal is made "as if" it was noticed
slightly later.  Note that the signal actual delivery is not changed,
it is done by ast on syscall return path, so signal handler is still
executed before first instruction after syscall.

See PR for the code demonstrating the issue.

PR:	203162
Reported by:	Victor Stinner victor.stinner@gmail.com
Reviewed by:	jilles
Tested by:	bapt, pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-20 21:18:33 +00:00
..
autofs Restore ABI compatibility, broken in r273127. Note that while this fixes 2015-02-10 16:17:16 +00:00
cd9660 Fix a bunch of -Wcast-qual warnings in cd9660_util.c, by using 2015-01-29 20:40:25 +00:00
cuse Don't use POLLNVAL as a return value from the client side poll 2015-01-13 13:32:18 +00:00
deadfs Style changes for deadfs: 2014-10-15 13:22:33 +00:00
devfs Make it possible to forcibly unmount devfs. 2015-08-24 14:04:44 +00:00
ext2fs - Remove some dead code copied from ffs. 2015-07-29 03:06:08 +00:00
fdescfs fd: make 'rights' a manadatory argument to fget* functions 2015-07-05 19:05:16 +00:00
fifofs Ensure that when a blockable open of fifo returns success, a valid 2015-09-20 21:18:33 +00:00
fuse File systems that do not use the buffer cache (such as ZFS) must 2015-04-15 20:16:31 +00:00
msdosfs File systems that do not use the buffer cache (such as ZFS) must 2015-04-15 20:16:31 +00:00
nandfs File systems that do not use the buffer cache (such as ZFS) must 2015-04-15 20:16:31 +00:00
nfs Fix an NFS server bug that manifested in "ls -al" displaying a plus 2015-08-28 14:26:11 +00:00
nfsclient nfsclient: Protest loudly when GETATTR responses are invalid 2015-08-05 22:27:30 +00:00
nfsserver For the case where an NFSv4.1 ExchangeID operation has the client identifier 2015-08-14 22:02:14 +00:00
nullfs Check suspendability on the mountpoint returned by VOP_GETWRITEMOUNT. 2015-07-05 22:37:33 +00:00
procfs The si_status field of the siginfo_t, provided by the waitid(2) and 2015-07-18 09:02:50 +00:00
pseudofs Hide vfs.pfs.trace variable if it is not used. 2015-05-24 18:11:22 +00:00
smbfs Fix a -Wcast-qual warning in smbfs_subr.c, by using __DECONST. No 2015-01-30 22:02:32 +00:00
tmpfs In tmpfs_chtimes(), remove checks on the nanosecond level when 2015-07-26 08:33:46 +00:00
udf Fix a -Wcast-qual warning in udf_vnops.c, by using __DECONST. No 2015-01-30 22:01:45 +00:00
unionfs Check suspendability on the mountpoint returned by VOP_GETWRITEMOUNT. 2015-07-05 22:37:33 +00:00