Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
5440bb0e
Commit
5440bb0e
authored
10 years ago
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix WriteAt race condition
parent
13c489ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
14 deletions
+5
-14
fuse/ipns/ipns_unix.go
fuse/ipns/ipns_unix.go
+5
-14
No files found.
fuse/ipns/ipns_unix.go
View file @
5440bb0e
...
...
@@ -296,22 +296,13 @@ func (fi *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.Read
}
func
(
fi
*
File
)
Write
(
ctx
context
.
Context
,
req
*
fuse
.
WriteRequest
,
resp
*
fuse
.
WriteResponse
)
error
{
errs
:=
make
(
chan
error
,
1
)
go
func
()
{
wrote
,
err
:=
fi
.
fi
.
WriteAt
(
req
.
Data
,
req
.
Offset
)
if
err
!=
nil
{
errs
<-
err
}
resp
.
Size
=
wrote
errs
<-
nil
}()
select
{
case
err
:=
<-
errs
:
// TODO: at some point, ensure that WriteAt here respects the context
wrote
,
err
:=
fi
.
fi
.
WriteAt
(
req
.
Data
,
req
.
Offset
)
if
err
!=
nil
{
return
err
case
<-
ctx
.
Done
()
:
return
ctx
.
Err
()
}
resp
.
Size
=
wrote
return
nil
}
func
(
fi
*
File
)
Flush
(
ctx
context
.
Context
,
req
*
fuse
.
FlushRequest
)
error
{
...
...
This diff is collapsed.
Click to expand it.
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