Skip to content

Commit a119432

Browse files
committed
fs: fix and document exec deadlock
Change-Id: Id00000007e5deb860c535755f71cf3299721ebc6
1 parent cd5e235 commit a119432

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

fs/api.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@
207207
// by calling "fusermount" with an inherited file descriptor, but the
208208
// same problem may occur for other file descriptors.
209209
//
210+
// 1c. If the executable is on the FUSE mount. In this case, the child
211+
// calls exec, which reads the file to execute, which triggers an OPEN
212+
// opcode. This can be worked around by invoking the subprocess
213+
// through a wrapper, eg `bash -c file/on/fuse-mount`.
214+
//
210215
// 2. The Go runtime uses the epoll system call to understand which
211216
// goroutines can respond to I/O. The runtime assumes that epoll does
212217
// not block, but if files are on a FUSE filesystem, the kernel will

fs/simple_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func TestExec(t *testing.T) {
173173
tc := newTestCase(t, &testOptions{attrCache: true, entryCache: true})
174174
tc.writeOrig("test.sh", "#!/bin/sh\ntrue\n", 0755)
175175
fn := tc.mntDir + "/test.sh"
176-
if err := exec.Command(fn).Run(); err != nil {
176+
if err := exec.Command("bash", "-c", fn).Run(); err != nil {
177177
t.Fatalf("Run: %v", err)
178178
}
179179
}

0 commit comments

Comments
 (0)