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
c76ff170
Commit
c76ff170
authored
Nov 21, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make go-fuse TSAN clean.
parent
92961189
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
fuse/fsetattr_test.go
fuse/fsetattr_test.go
+6
-3
fuse/mountstate.go
fuse/mountstate.go
+18
-0
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+1
-0
No files found.
fuse/fsetattr_test.go
View file @
c76ff170
...
...
@@ -130,7 +130,7 @@ func NewFile() *MutableDataFile {
return
&
MutableDataFile
{}
}
func
setupFAttrTest
(
t
*
testing
.
T
,
fs
FileSystem
)
(
dir
string
,
clean
func
())
{
func
setupFAttrTest
(
t
*
testing
.
T
,
fs
FileSystem
)
(
dir
string
,
clean
func
()
,
sync
func
()
)
{
dir
,
err
:=
ioutil
.
TempDir
(
""
,
"go-fuse"
)
CheckSuccess
(
err
)
nfs
:=
NewPathNodeFs
(
fs
,
nil
)
...
...
@@ -150,12 +150,14 @@ func setupFAttrTest(t *testing.T, fs FileSystem) (dir string, clean func()) {
if
state
.
Unmount
()
==
nil
{
os
.
RemoveAll
(
dir
)
}
},
func
()
{
state
.
ThreadSanitizerSync
()
}
}
func
TestDataReadLarge
(
t
*
testing
.
T
)
{
fs
:=
&
FSetAttrFs
{}
dir
,
clean
:=
setupFAttrTest
(
t
,
fs
)
dir
,
clean
,
_
:=
setupFAttrTest
(
t
,
fs
)
defer
clean
()
content
:=
RandomData
(
385
*
1023
)
...
...
@@ -170,7 +172,7 @@ func TestDataReadLarge(t *testing.T) {
func
TestFSetAttr
(
t
*
testing
.
T
)
{
fs
:=
&
FSetAttrFs
{}
dir
,
clean
:=
setupFAttrTest
(
t
,
fs
)
dir
,
clean
,
sync
:=
setupFAttrTest
(
t
,
fs
)
defer
clean
()
fn
:=
dir
+
"/file"
...
...
@@ -184,6 +186,7 @@ func TestFSetAttr(t *testing.T) {
_
,
err
=
f
.
WriteString
(
"hello"
)
CheckSuccess
(
err
)
sync
()
code
:=
syscall
.
Ftruncate
(
int
(
f
.
Fd
()),
3
)
if
code
!=
nil
{
t
.
Error
(
"truncate retval"
,
os
.
NewSyscallError
(
"Ftruncate"
,
code
))
...
...
fuse/mountstate.go
View file @
c76ff170
...
...
@@ -47,6 +47,24 @@ type MountState struct {
loops
sync
.
WaitGroup
}
// Use this method to make synchronization between accessing a
// filesystem object through the operating system, and accessing a
// filesystem internally, so thread-sanitizer does not get confused.
//
// fs := SomeFSObj{ReadCalled: false}
// ms := NewMountState(fs)
// ms.Mount("/mnt", nil)
// ..
// ioutil.ReadFile("/mnt/file")
//
// mountstate.ThreadSanitizerSync()
// if fs.ReadCalled { ... // no race condition here.
//
func
(
ms
*
MountState
)
ThreadSanitizerSync
()
{
ms
.
reqMu
.
Lock
()
ms
.
reqMu
.
Unlock
()
}
func
(
ms
*
MountState
)
KernelSettings
()
raw
.
InitIn
{
return
ms
.
kernelSettings
}
...
...
unionfs/unionfs_test.go
View file @
c76ff170
...
...
@@ -912,6 +912,7 @@ func TestUnionFsDisappearing(t *testing.T) {
CheckSuccess
(
err
)
oldRoot
:=
wrFs
.
Root
state
.
ThreadSanitizerSync
()
wrFs
.
Root
=
"/dev/null"
time
.
Sleep
((
3
*
entryTtl
)
/
2
)
...
...
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