This patch by Lynn Boger removes unnecessary duplicate calls to Entersyscall and Exitsyscall from the GNU/Linux Getdents function. The calls are duplicates because they are called by Syscall, also called by Getdents. These duplicate calls sometimes cause the deadlock detector to fire incorrectly, reported as http://golang.org/issue/11406 . This patch fixes that problem. Bootstrapped and ran Go tests on mainline, GCC 4.9 branch, and GCC 5 branch. Committed to mainline and 4.9 branch.
Release managers: OK to commit to GCC 5 branch? Ian
Index: libgo/go/syscall/libcall_linux.go =================================================================== --- libgo/go/syscall/libcall_linux.go (revision 225715) +++ libgo/go/syscall/libcall_linux.go (working copy) @@ -223,7 +223,6 @@ func Getdents(fd int, buf []byte) (n int } else { p = (*byte)(unsafe.Pointer(&_zero)) } - Entersyscall() s := SYS_GETDENTS64 if s == 0 { s = SYS_GETDENTS @@ -233,7 +232,6 @@ func Getdents(fd int, buf []byte) (n int if n < 0 { err = errno } - Exitsyscall() return }