Commit 9972ff86 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Use treeLock in GetPath().

This fixes potential race condition with rename happening in parallel
to something else.
parent 6ed7e494
...@@ -116,6 +116,11 @@ func (me *FileSystemConnector) Unmount(path string) Status { ...@@ -116,6 +116,11 @@ func (me *FileSystemConnector) Unmount(path string) Status {
func (me *FileSystemConnector) GetPath(nodeid uint64) (path string, mount *mountData, node *inode) { func (me *FileSystemConnector) GetPath(nodeid uint64) (path string, mount *mountData, node *inode) {
n := me.getInodeData(nodeid) n := me.getInodeData(nodeid)
// Need to lock because renames create invalid states.
me.treeLock.RLock()
defer me.treeLock.RUnlock()
p, m := n.GetPath() p, m := n.GetPath()
return p, m, n return p, m, n
} }
......
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