Commit b8a27afb authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: drop Server.ThreadSanitizerSync, and switch on -race tests in all.bash.

parent 7acec635
...@@ -15,7 +15,7 @@ done ...@@ -15,7 +15,7 @@ done
for d in fuse zipfs unionfs for d in fuse zipfs unionfs
do do
(cd $d && go test go-fuse/$d ) (cd $d && go test go-fuse/$d && go test -race go-fuse/$d)
done done
make -C benchmark make -C benchmark
......
...@@ -288,7 +288,7 @@ func (m *int64HandleMap) Register(obj *handled) (handle uint64) { ...@@ -288,7 +288,7 @@ func (m *int64HandleMap) Register(obj *handled) (handle uint64) {
obj.handle = handle obj.handle = handle
m.handles[handle] = obj m.handles[handle] = obj
} else { } else {
handle = m.Handle(obj) handle = m.handle(obj)
} }
obj.count++ obj.count++
m.mutex.Unlock() m.mutex.Unlock()
...@@ -296,7 +296,7 @@ func (m *int64HandleMap) Register(obj *handled) (handle uint64) { ...@@ -296,7 +296,7 @@ func (m *int64HandleMap) Register(obj *handled) (handle uint64) {
return handle return handle
} }
func (m *int64HandleMap) Handle(obj *handled) (handle uint64) { func (m *int64HandleMap) handle(obj *handled) (handle uint64) {
if obj.count == 0 { if obj.count == 0 {
return 0 return 0
} }
...@@ -307,6 +307,13 @@ func (m *int64HandleMap) Handle(obj *handled) (handle uint64) { ...@@ -307,6 +307,13 @@ func (m *int64HandleMap) Handle(obj *handled) (handle uint64) {
return handle return handle
} }
func (m *int64HandleMap) Handle(obj *handled) (handle uint64) {
m.mutex.Lock()
m.mutex.Unlock()
return m.handle(obj)
}
func (m *int64HandleMap) Forget(handle uint64, count int) (forgotten bool, obj *handled) { func (m *int64HandleMap) Forget(handle uint64, count int) (forgotten bool, obj *handled) {
defer m.verify() defer m.verify()
obj = m.Decode(handle) obj = m.Decode(handle)
......
...@@ -49,24 +49,6 @@ type Server struct { ...@@ -49,24 +49,6 @@ type Server struct {
loops sync.WaitGroup loops sync.WaitGroup
} }
// Use this method to make synchronization between accessing a
// filesystem object through the operating system, and accessing a
// filesystem internally, so thread-sanitizer does not get confused.
//
// fs := SomeFSObj{ReadCalled: false}
// ms := NewServer(fs)
// ms.Mount("/mnt", nil)
// ..
// ioutil.ReadFile("/mnt/file")
//
// mountstate.ThreadSanitizerSync()
// if fs.ReadCalled { ... // no race condition here.
//
func (ms *Server) ThreadSanitizerSync() {
ms.reqMu.Lock()
ms.reqMu.Unlock()
}
func (ms *Server) SetDebug(dbg bool) { func (ms *Server) SetDebug(dbg bool) {
ms.debug = dbg ms.debug = dbg
} }
......
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