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
33fc3c76
Commit
33fc3c76
authored
Nov 22, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Synchronize nodeId access in notify functions.
parent
4a345b8f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
8 deletions
+27
-8
fuse/fsconnector.go
fuse/fsconnector.go
+19
-4
fuse/inode.go
fuse/inode.go
+2
-2
fuse/mount_test.go
fuse/mount_test.go
+4
-1
fuse/mountstate.go
fuse/mountstate.go
+2
-1
No files found.
fuse/fsconnector.go
View file @
33fc3c76
...
...
@@ -121,9 +121,10 @@ func (c *FileSystemConnector) lookupUpdate(node *Inode) uint64 {
node
.
nodeId
=
c
.
inodeMap
.
Register
(
&
node
.
handled
,
node
)
}
node
.
lookupCount
+=
1
id
:=
node
.
nodeId
node
.
treeLock
.
Unlock
()
return
node
.
nodeI
d
return
i
d
}
// Must run outside treeLock.
...
...
@@ -294,6 +295,7 @@ func (c *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFileS
//
// EBUSY: there are open files, or submounts below this node.
func
(
c
*
FileSystemConnector
)
Unmount
(
node
*
Inode
)
Status
{
// TODO - racy.
if
node
.
mountPoint
==
nil
{
log
.
Println
(
"not a mountpoint:"
,
node
.
nodeId
)
return
EINVAL
...
...
@@ -324,13 +326,14 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status {
delete
(
parentNode
.
children
,
name
)
mount
.
fs
.
OnUnmount
()
c
.
DeleteNotify
(
parentNode
,
mountInode
,
name
)
c
.
fsInit
.
DeleteNotify
(
parentNode
.
nodeId
,
mountInode
.
nodeId
,
name
)
return
OK
}
func
(
c
*
FileSystemConnector
)
FileNotify
(
node
*
Inode
,
off
int64
,
length
int64
)
Status
{
node
.
treeLock
.
RLock
()
n
:=
node
.
nodeId
node
.
treeLock
.
RUnlock
()
if
node
==
c
.
rootNode
{
n
=
raw
.
FUSE_ROOT_ID
}
...
...
@@ -346,7 +349,9 @@ func (c *FileSystemConnector) FileNotify(node *Inode, off int64, length int64) S
}
func
(
c
*
FileSystemConnector
)
EntryNotify
(
dir
*
Inode
,
name
string
)
Status
{
dir
.
treeLock
.
RLock
()
n
:=
dir
.
nodeId
dir
.
treeLock
.
RUnlock
()
if
dir
==
c
.
rootNode
{
n
=
raw
.
FUSE_ROOT_ID
}
...
...
@@ -357,12 +362,22 @@ func (c *FileSystemConnector) EntryNotify(dir *Inode, name string) Status {
}
func
(
c
*
FileSystemConnector
)
DeleteNotify
(
dir
*
Inode
,
child
*
Inode
,
name
string
)
Status
{
dir
.
treeLock
.
RLock
()
n
:=
dir
.
nodeId
var
chId
uint64
if
child
.
treeLock
!=
dir
.
treeLock
{
child
.
treeLock
.
RLock
()
chId
=
child
.
nodeId
child
.
treeLock
.
RUnlock
()
}
dir
.
treeLock
.
RUnlock
()
if
dir
==
c
.
rootNode
{
n
=
raw
.
FUSE_ROOT_ID
}
if
n
==
0
{
return
OK
}
return
c
.
fsInit
.
DeleteNotify
(
n
,
ch
ild
.
node
Id
,
name
)
return
c
.
fsInit
.
DeleteNotify
(
n
,
chId
,
name
)
}
fuse/inode.go
View file @
33fc3c76
...
...
@@ -41,8 +41,8 @@ type Inode struct {
// The nodeId is only used to communicate to the kernel. If
// it is zero, it means the kernel does not know about this
// Inode.
You should probably never read nodeId, but always
// d
o lookupUpdate() on the node instead
.
// Inode.
Only forget/lookup/notify methods should nodeId
// d
irectly
.
nodeId
uint64
// lookupCount registers how often the kernel got this inode
...
...
fuse/mount_test.go
View file @
33fc3c76
...
...
@@ -27,7 +27,10 @@ func TestMountOnExisting(t *testing.T) {
t
.
Fatal
(
"expect OK:"
,
code
)
}
ts
.
pathFs
.
Unmount
(
"mnt"
)
code
=
ts
.
pathFs
.
Unmount
(
"mnt"
)
if
!
code
.
Ok
()
{
t
.
Errorf
(
"Unmount failed: %v"
,
code
)
}
}
func
TestMountRename
(
t
*
testing
.
T
)
{
...
...
fuse/mountstate.go
View file @
33fc3c76
...
...
@@ -153,7 +153,8 @@ func (ms *MountState) Unmount() (err error) {
if
err
==
nil
{
break
}
fmt
.
Fprintf
(
os
.
Stderr
,
"umount failed; retrying
\n
"
)
// Sleep for a bit. This is not pretty, but there is
// no way we can be certain that the kernel thinks all
// open files have already been closed.
...
...
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