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

Fix deadlock in getOpenFileData() caused by taking the same RLock

twice.
parent ca66423a
...@@ -259,7 +259,8 @@ func (me *inode) GetFullPath() (path string) { ...@@ -259,7 +259,8 @@ func (me *inode) GetFullPath() (path string) {
// GetPath returns the path relative to the mount governing this // GetPath returns the path relative to the mount governing this
// inode. It returns nil for mount if the file was deleted or the // inode. It returns nil for mount if the file was deleted or the
// filesystem unmounted. // filesystem unmounted. This will take the treeLock for the mount,
// so it can not be used in internal methods.
func (me *inode) GetPath() (path string, mount *fileSystemMount) { func (me *inode) GetPath() (path string, mount *fileSystemMount) {
me.treeLock.RLock() me.treeLock.RLock()
defer me.treeLock.RUnlock() defer me.treeLock.RUnlock()
...@@ -660,9 +661,6 @@ func (me *FileSystemConnector) unsafeUnmountNode(node *inode) { ...@@ -660,9 +661,6 @@ func (me *FileSystemConnector) unsafeUnmountNode(node *inode) {
func (me *FileSystemConnector) getOpenFileData(nodeid uint64, fh uint64) (f File, m *fileSystemMount, p string, node *inode) { func (me *FileSystemConnector) getOpenFileData(nodeid uint64, fh uint64) (f File, m *fileSystemMount, p string, node *inode) {
node = me.getInodeData(nodeid) node = me.getInodeData(nodeid)
node.treeLock.RLock()
defer node.treeLock.RUnlock()
if fh != 0 { if fh != 0 {
opened := me.getOpenedFile(fh) opened := me.getOpenedFile(fh)
m = opened.fileSystemMount m = opened.fileSystemMount
......
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