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
f72abcb4
Commit
f72abcb4
authored
Sep 20, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make lookupUpdate take the treeLock too.
Simplifies the API, and fixes a race condition.
parent
e9d284fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
fuse/fsconnector.go
fuse/fsconnector.go
+8
-6
fuse/fsops.go
fuse/fsops.go
+0
-2
No files found.
fuse/fsconnector.go
View file @
f72abcb4
...
...
@@ -60,12 +60,12 @@ func NewFileSystemConnector(nodeFs NodeFileSystem, opts *FileSystemOptions) (me
me
.
inodeMap
=
NewHandleMap
(
opts
.
PortableInodes
)
me
.
rootNode
=
newInode
(
true
,
nodeFs
.
Root
())
me
.
verify
()
me
.
MountRoot
(
nodeFs
,
opts
)
// FUSE does not issue a LOOKUP for 1 (obviously), but it does
// issue a forget. This lookupUpdate is to make the counts match.
me
.
lookupUpdate
(
me
.
rootNode
)
me
.
verify
()
me
.
MountRoot
(
nodeFs
,
opts
)
return
me
}
...
...
@@ -104,8 +104,12 @@ func (me *FileSystemConnector) toInode(nodeid uint64) *Inode {
return
i
}
// Must run in treeLock. Returns the nodeId.
// Must run outside treeLock. Returns the nodeId.
//
// TODO - write a stress test to exercise this.
func
(
me
*
FileSystemConnector
)
lookupUpdate
(
node
*
Inode
)
uint64
{
node
.
treeLock
.
Lock
()
defer
node
.
treeLock
.
Unlock
()
if
node
.
lookupCount
==
0
{
node
.
nodeId
=
me
.
inodeMap
.
Register
(
&
node
.
handled
,
node
)
}
...
...
@@ -114,8 +118,6 @@ func (me *FileSystemConnector) lookupUpdate(node *Inode) uint64 {
}
// Must run outside treeLock.
//
// TODO - reconcile api for lookupUpdate() and forgetUpdate().
func
(
me
*
FileSystemConnector
)
forgetUpdate
(
node
*
Inode
,
forgetCount
int
)
{
defer
me
.
verify
()
...
...
fuse/fsops.go
View file @
f72abcb4
...
...
@@ -23,8 +23,6 @@ func (me *FileSystemConnector) lookupMountUpdate(mount *fileSystemMount) (out *E
if
!
err
.
Ok
()
{
return
nil
,
err
}
mount
.
treeLock
.
Lock
()
defer
mount
.
treeLock
.
Unlock
()
out
=
mount
.
fileInfoToEntry
(
fi
)
out
.
NodeId
=
me
.
lookupUpdate
(
mount
.
mountInode
)
...
...
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