Commit 27a473d5 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse/test: avoid low-numbered fds for FUSE-backed files

As part of the fork/exec sequence, file descriptors that should be
inherited are remapped with dup3() in the chld process. This causes
implicit file close operations. If the file descriptors are backed by
FUSE, this leads to FLUSH operations. If parallelism is limited with
GOMAXPROCS, this can cause a deadlock, as there will not be threads
left to service the FLUSH opcodes.

Fixes #489

Change-Id: I81bf4ab0624495aabb5bb9ec42a55c6f23340beb
parent 22d9c9dc
......@@ -32,6 +32,17 @@ func TestFlockExclusive(t *testing.T) {
contents := []byte{1, 2, 3}
tc.WriteFile(tc.origFile, []byte(contents), 0700)
for {
f, err := os.Open("/dev/null")
if err != nil {
t.Fatalf("Open(/dev/null): %v", err)
}
defer f.Close()
if f.Fd() > 3 {
break
}
}
f, err := os.OpenFile(tc.mountFile, os.O_WRONLY, 0)
if err != nil {
t.Fatalf("OpenFile(%q): %v", tc.mountFile, err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment