Commit 4dece6d7 authored by lch's avatar lch Committed by Han-Wen Nienhuys

fuse: fix hang under Darwin and FreeBSD when umount

Both FreeBSD and Darwin must use a single reader to access the FUSE device.

Change-Id: I51c467bb0b8e1fda871665d033dd89d11fbe961c
parent 1072b7f0
......@@ -195,14 +195,11 @@ func NewServer(fs RawFileSystem, mountPoint string, opts *MountOptions) (*Server
}
ms := &Server{
fileSystem: fs,
opts: &o,
maxReaders: maxReaders,
retrieveTab: make(map[uint64]*retrieveCacheRequest),
// OSX has races when multiple routines read from the
// FUSE device: on unmount, sometime some reads do not
// error-out, meaning that unmount will hang.
singleReader: runtime.GOOS == "darwin",
fileSystem: fs,
opts: &o,
maxReaders: maxReaders,
retrieveTab: make(map[uint64]*retrieveCacheRequest),
singleReader: useSingleReader,
ready: make(chan error, 1),
}
ms.reqPool.New = func() interface{} {
......
......@@ -8,6 +8,8 @@ import (
"syscall"
)
const useSingleReader = false
func (ms *Server) systemWrite(req *request, header []byte) Status {
if req.flatDataSize() == 0 {
err := handleEINTR(func() error {
......
......@@ -6,6 +6,11 @@ import (
"golang.org/x/sys/unix"
)
// OSX and FreeBSD has races when multiple routines read
// from the FUSE device: on unmount, sometime some reads
// do not error-out, meaning that unmount will hang.
const useSingleReader = true
func (ms *Server) systemWrite(req *request, header []byte) Status {
if req.flatDataSize() == 0 {
err := handleEINTR(func() error {
......
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