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
a8c70d06
Commit
a8c70d06
authored
Jun 08, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Have verify acquire locks correctly.
parent
01ca8a7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
fuse/fsconnector.go
fuse/fsconnector.go
+4
-3
fuse/inode.go
fuse/inode.go
+3
-0
No files found.
fuse/fsconnector.go
View file @
a8c70d06
...
...
@@ -82,6 +82,8 @@ func (c *FileSystemConnector) nextGeneration() uint64 {
return
atomic
.
AddUint64
(
&
c
.
generation
,
1
)
}
// This verifies invariants of the data structure. This routine
// acquires tree locks as it walks the inode tree.
func
(
c
*
FileSystemConnector
)
verify
()
{
if
!
paranoia
{
return
...
...
@@ -136,8 +138,6 @@ func (c *FileSystemConnector) lookupUpdate(node *Inode) uint64 {
// Must run outside treeLock.
func
(
c
*
FileSystemConnector
)
forgetUpdate
(
node
*
Inode
,
forgetCount
int
)
{
defer
c
.
verify
()
node
.
treeLock
.
Lock
()
node
.
lookupCount
-=
forgetCount
if
node
.
lookupCount
==
0
{
...
...
@@ -149,6 +149,7 @@ func (c *FileSystemConnector) forgetUpdate(node *Inode, forgetCount int) {
c
.
recursiveConsiderDropInode
(
node
)
node
.
treeLock
.
Unlock
()
c
.
verify
()
}
// InodeCount returns the number of inodes registered with the kernel.
...
...
@@ -269,6 +270,7 @@ func (c *FileSystemConnector) MountRoot(nodeFs NodeFileSystem, opts *FileSystemO
//
// EBUSY: the intended mount point already exists.
func
(
c
*
FileSystemConnector
)
Mount
(
parent
*
Inode
,
name
string
,
nodeFs
NodeFileSystem
,
opts
*
FileSystemOptions
)
Status
{
defer
c
.
verify
()
parent
.
treeLock
.
Lock
()
defer
parent
.
treeLock
.
Unlock
()
node
:=
parent
.
children
[
name
]
...
...
@@ -294,7 +296,6 @@ func (c *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFileS
log
.
Println
(
"Mount: "
,
nodeFs
,
"on subdir"
,
name
,
"parent"
,
parent
.
nodeId
)
}
c
.
verify
()
nodeFs
.
OnMount
(
c
)
return
OK
}
...
...
fuse/inode.go
View file @
a8c70d06
...
...
@@ -249,6 +249,9 @@ func (n *Inode) verify(cur *fileSystemMount) {
log
.
Panicf
(
"mountpoint mismatch %v %v"
,
n
,
n
.
mountPoint
.
mountInode
)
}
cur
=
n
.
mountPoint
cur
.
treeLock
.
Lock
()
defer
cur
.
treeLock
.
Unlock
()
}
if
n
.
mount
!=
cur
{
log
.
Panicf
(
"n.mount not set correctly %v %v"
,
n
.
mount
,
cur
)
...
...
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