Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
50f78858
Commit
50f78858
authored
Feb 21, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
00894b04
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+20
-7
No files found.
wcfs/client/wcfs.cpp
View file @
50f78858
...
...
@@ -705,6 +705,7 @@ error _FileH::close() {
// XXX decref open count
// XXX fileh.close can be called several times and after first call another
// XXX fileh could be opened for the same foid. Be careful not to interfere with it.
// -> just return nil for second close
// XXX locking ok?
wconn
->
_atMu
.
RLock
();
...
...
@@ -740,6 +741,16 @@ error _FileH::close() {
// virtmem calls FileH::mmap under virtmem lock when virtmem fileh is mmapped into vma.
pair
<
Mapping
,
error
>
_FileH
::
mmap
(
int64_t
blk_start
,
int64_t
blk_len
,
VMA
*
vma
)
{
_FileH
&
f
=
*
this
;
// NOTE virtmem lock is held by virtmem caller
// XXX locking ok?
f
.
wconn
->
_atMu
.
RLock
();
// e.g. f._headfsize
f
.
_mu
.
lock
();
// f._pinned, f._mmaps
defer
([
&
]()
{
f
.
_mu
.
unlock
();
f
.
wconn
->
_atMu
.
RUnlock
();
});
xerr
::
Contextf
E
(
"%s: mmap f<%s> [blk%ld +blk%ld)"
,
v
(
f
.
wconn
),
v
(
f
.
foid
),
blk_start
,
blk_len
);
error
err
;
...
...
@@ -758,10 +769,6 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
panic
(
"(blk_start + blk_len)*f.blksize overflow int64"
);
int64_t
start
=
blk_start
*
f
.
blksize
;
// NOTE virtmem lock is held by virtmem caller
// XXX locking
// XXX + wconn.atMu.RLock() ? -> y (e.g. f.headfsize is used)
// f.mu.lock()
// create memory with head/f mapping and applied pins
// mmap-in zeros after f.size (else access to memory after file.size will raise SIGBUS)
...
...
@@ -828,11 +835,17 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
error
_Mapping
::
unmap
()
{
Mapping
mmap
=
newref
(
this
);
// XXX newref for std::remove
FileH
f
=
mmap
->
fileh
;
xerr
::
Contextf
E
(
"%s: f<%s>: unmap"
,
v
(
f
->
wconn
),
v
(
f
->
foid
));
// NOTE virtmem lock is held by virtmem caller
// XXX locking
// wconn.atMu.RLock() + f.mu.lock()
// XXX locking ok?
f
->
wconn
->
_atMu
.
RLock
();
f
->
_mu
.
lock
();
// f._mmaps
defer
([
&
]()
{
f
->
_mu
.
unlock
();
f
->
wconn
->
_atMu
.
RUnlock
();
});
xerr
::
Contextf
E
(
"%s: f<%s>: unmap"
,
v
(
f
->
wconn
),
v
(
f
->
foid
));
if
(
mmap
->
vma
!=
nil
)
{
mmap
->
_assertVMAOk
();
...
...
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