net: do not use RLock around Accept
It might be non-blocking, but it also might be blocking.
Cannot take the chance, as Accept might block indefinitely
and make it impossible to acquire ForkLock exclusively
(during fork+exec).
Fixes #4737.
R=golang-dev, dave, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7309050
diff --git a/src/pkg/net/fd_unix.go b/src/pkg/net/fd_unix.go
index a976742..9f710e2 100644
--- a/src/pkg/net/fd_unix.go
+++ b/src/pkg/net/fd_unix.go
@@ -661,6 +661,9 @@
syscall.ForkLock.RUnlock()
// We want blocking mode for the new fd, hence the double negative.
+ // This also puts the old fd into blocking mode, meaning that
+ // I/O will block the thread instead of letting us use the epoll server.
+ // Everything will still work, just with more threads.
if err = syscall.SetNonblock(ns, false); err != nil {
return nil, &OpError{"setnonblock", fd.net, fd.laddr, err}
}