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
7572e9d8
Commit
7572e9d8
authored
Apr 07, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: protect dirsteam overflow with lock
Appeases the race detector.
parent
623db2fc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
nodefs/bridge.go
nodefs/bridge.go
+9
-1
No files found.
nodefs/bridge.go
View file @
7572e9d8
...
...
@@ -27,6 +27,8 @@ type fileEntry struct {
// Directory
dirStream
DirStream
mu
sync
.
Mutex
hasOverflow
bool
overflow
fuse
.
DirEntry
...
...
@@ -833,16 +835,20 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
if
errno
:=
b
.
setStream
(
cancel
,
input
,
n
,
f
);
errno
!=
0
{
return
errnoToStatus
(
errno
)
}
ctx
:=
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
}
for
f
.
dirStream
.
HasNext
()
{
var
e
fuse
.
DirEntry
var
errno
syscall
.
Errno
f
.
mu
.
Lock
()
if
f
.
hasOverflow
{
e
=
f
.
overflow
f
.
hasOverflow
=
false
}
else
{
e
,
errno
=
f
.
dirStream
.
Next
()
}
f
.
mu
.
Unlock
()
if
errno
!=
0
{
return
errnoToStatus
(
errno
)
...
...
@@ -850,8 +856,10 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
entryOut
:=
out
.
AddDirLookupEntry
(
e
)
if
entryOut
==
nil
{
f
.
mu
.
Lock
()
f
.
overflow
=
e
f
.
hasOverflow
=
true
f
.
mu
.
Unlock
()
return
fuse
.
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