[Bug 203162] when close(fd) on a fifo fails with EINTR, the file descriptor is not really closed

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Sep 17 13:43:22 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203162

--- Comment #6 from Konstantin Belousov <kib at FreeBSD.org> ---
(In reply to Victor Stinner from comment #5)
FreeBSD also ensures that both open(O_RDONLY) and open(O_WRONLY) succeed
simultaneously, but there is a race.

Assume that both threads doing the opens noticed each other presence, but right
after that the thread doing open(O_RDONLY) continued execution, while the
thread doing(O_WRONLY) was not put on the CPU immediately.  It was a scheduler
decision, for whatever reasons.  Then, open(O_RDONLY) succeeds, the thread
continues the execution and then it could even run as far as to execute close()
on the fd returned by open.  After that, when open(O_WRONLY) thread eventually
gets CPU, it notices that there is no readers (there was one, but it is gone
now).  So it returns to the sleep waiting for a reader.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list