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
Kirill Smelkov
go-fuse
Commits
84301c8f
Commit
84301c8f
authored
Mar 15, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse: fix race condition in unmount.
parent
44a49fb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
fuse/fsconnector.go
fuse/fsconnector.go
+26
-5
No files found.
fuse/fsconnector.go
View file @
84301c8f
...
...
@@ -296,6 +296,8 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status {
return
EINVAL
}
nodeId
:=
c
.
inodeMap
.
Handle
(
&
node
.
handled
)
// Must lock parent to update tree structure.
parentNode
:=
node
.
mountPoint
.
parentInode
parentNode
.
mount
.
treeLock
.
Lock
()
...
...
@@ -320,10 +322,6 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status {
return
EBUSY
}
mount
.
mountInode
=
nil
// TODO - racy.
node
.
mountPoint
=
nil
delete
(
parentNode
.
children
,
name
)
mount
.
fs
.
OnUnmount
()
...
...
@@ -333,7 +331,30 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status {
parentId
=
raw
.
FUSE_ROOT_ID
}
c
.
fsInit
.
DeleteNotify
(
parentId
,
c
.
inodeMap
.
Handle
(
&
node
.
handled
),
name
)
// We have to wait until the kernel has forgotten the
// mountpoint, so the write to node.mountPoint is no longer
// racy.
code
:=
c
.
fsInit
.
DeleteNotify
(
parentId
,
c
.
inodeMap
.
Handle
(
&
node
.
handled
),
name
)
if
code
.
Ok
()
{
mount
.
treeLock
.
Unlock
()
parentNode
.
mount
.
treeLock
.
Unlock
()
delay
:=
100
*
time
.
Microsecond
for
{
// This operation is rare, so we kludge it to avoid
// contention.
time
.
Sleep
(
delay
)
delay
=
delay
*
2
+
1
if
!
c
.
inodeMap
.
Has
(
nodeId
)
{
break
}
}
parentNode
.
mount
.
treeLock
.
Lock
()
mount
.
treeLock
.
Lock
()
}
mount
.
mountInode
=
nil
node
.
mountPoint
=
nil
return
OK
}
...
...
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