Commit 96c47482 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Fix raciness in MountState.kernelSettings access.

parent 3a2e2a0c
......@@ -35,13 +35,13 @@ type MountState struct {
latencies *LatencyMap
opts *MountOptions
kernelSettings raw.InitIn
reqMu sync.Mutex
reqPool []*request
readPool [][]byte
reqReaders int
outstandingReadBufs int
kernelSettings raw.InitIn
canSplice bool
loops sync.WaitGroup
......@@ -66,7 +66,11 @@ func (ms *MountState) ThreadSanitizerSync() {
}
func (ms *MountState) KernelSettings() raw.InitIn {
return ms.kernelSettings
ms.reqMu.Lock()
s := ms.kernelSettings
ms.reqMu.Unlock()
return s
}
func (ms *MountState) MountPoint() string {
......@@ -153,7 +157,7 @@ func (ms *MountState) Unmount() (err error) {
if err == nil {
break
}
fmt.Fprintf(os.Stderr, "umount failed; retrying\n")
// Sleep for a bit. This is not pretty, but there is
// no way we can be certain that the kernel thinks all
......
......@@ -85,6 +85,7 @@ func doInit(state *MountState, req *request) {
return
}
state.reqMu.Lock()
state.kernelSettings = *input
state.kernelSettings.Flags = input.Flags & (raw.CAP_ASYNC_READ | raw.CAP_BIG_WRITES | raw.CAP_FILE_OPS)
if input.Minor >= 13 {
......@@ -94,6 +95,7 @@ func doInit(state *MountState, req *request) {
state.opts.MaxWrite = maxW
}
}
state.reqMu.Unlock()
out := &raw.InitOut{
Major: FUSE_KERNEL_VERSION,
......
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