Commit 4ee2ee46 authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher Committed by Han-Wen Nienhuys

fuse: Server: catch duplicate Serve() calls

Calling Serve() multiple times leads to a panic on unmount and fun
debugging sessions ( https://github.com/hanwen/go-fuse/issues/512 ).
Catch it early.

Change-Id: I3c490448fa3b8407a6db1bd8ad94b8a4e1a93828
parent 4a6c005a
......@@ -76,6 +76,7 @@ type Server struct {
singleReader bool
canSplice bool
loops sync.WaitGroup
serving bool // for preventing duplicate Serve() calls
ready chan error
......@@ -416,6 +417,14 @@ func (ms *Server) recordStats(req *request) {
//
// Each filesystem operation executes in a separate goroutine.
func (ms *Server) Serve() {
if ms.serving {
// Calling Serve() multiple times leads to a panic on unmount and fun
// debugging sessions ( https://github.com/hanwen/go-fuse/issues/512 ).
// Catch it early.
log.Panic("Serve() must only be called once, you have called it a second time")
}
ms.serving = true
ms.loop(false)
ms.loops.Wait()
......
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