Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
e868a0d4
Commit
e868a0d4
authored
Aug 25, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deadlock in getOpenFileData() caused by taking the same RLock
twice.
parent
ca66423a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+5
-7
No files found.
fuse/pathfilesystem.go
View file @
e868a0d4
...
@@ -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
()
...
@@ -474,7 +475,7 @@ func (me *FileSystemConnector) findLastKnownInode(fullPath string) (*inode, []st
...
@@ -474,7 +475,7 @@ func (me *FileSystemConnector) findLastKnownInode(fullPath string) (*inode, []st
if
fullPath
==
""
{
if
fullPath
==
""
{
return
me
.
rootNode
,
nil
return
me
.
rootNode
,
nil
}
}
fullPath
=
strings
.
TrimLeft
(
filepath
.
Clean
(
fullPath
),
"/"
)
fullPath
=
strings
.
TrimLeft
(
filepath
.
Clean
(
fullPath
),
"/"
)
comps
:=
strings
.
Split
(
fullPath
,
"/"
)
comps
:=
strings
.
Split
(
fullPath
,
"/"
)
...
@@ -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
...
@@ -673,7 +671,7 @@ func (me *FileSystemConnector) getOpenFileData(nodeid uint64, fh uint64) (f File
...
@@ -673,7 +671,7 @@ func (me *FileSystemConnector) getOpenFileData(nodeid uint64, fh uint64) (f File
if
me
.
Debug
{
if
me
.
Debug
{
log
.
Printf
(
"Node %v = '%s'"
,
nodeid
,
path
)
log
.
Printf
(
"Node %v = '%s'"
,
nodeid
,
path
)
}
}
// If the file was deleted, GetPath() will return nil.
// If the file was deleted, GetPath() will return nil.
if
mount
!=
nil
{
if
mount
!=
nil
{
m
=
mount
m
=
mount
...
@@ -719,7 +717,7 @@ func (me *FileSystemConnector) Notify(path string) Status {
...
@@ -719,7 +717,7 @@ func (me *FileSystemConnector) Notify(path string) Status {
node
,
rest
:=
me
.
findLastKnownInode
(
path
)
node
,
rest
:=
me
.
findLastKnownInode
(
path
)
if
len
(
rest
)
>
0
{
if
len
(
rest
)
>
0
{
return
me
.
fsInit
.
EntryNotify
(
node
.
NodeId
,
rest
[
0
])
return
me
.
fsInit
.
EntryNotify
(
node
.
NodeId
,
rest
[
0
])
}
}
out
:=
NotifyInvalInodeOut
{
out
:=
NotifyInvalInodeOut
{
Ino
:
node
.
NodeId
,
Ino
:
node
.
NodeId
,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment