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
7a2b1dad
Commit
7a2b1dad
authored
Feb 18, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f4e73727
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+7
-1
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+1
-0
No files found.
wcfs/client/wcfs.cpp
View file @
7a2b1dad
...
@@ -120,6 +120,7 @@ error _Conn::close() {
...
@@ -120,6 +120,7 @@ error _Conn::close() {
_Conn
&
wconn
=
*
this
;
_Conn
&
wconn
=
*
this
;
xerr
::
Contextf
E
(
"wcfs %s: close conn @%s"
,
v
(
wconn
.
_wc
->
mountpoint
),
v
(
wconn
.
at
));
xerr
::
Contextf
E
(
"wcfs %s: close conn @%s"
,
v
(
wconn
.
_wc
->
mountpoint
),
v
(
wconn
.
at
));
// XXX + conn # e.g. from wconn._wlink.id? or wlink.close should include its id itself?
// XXX + conn # e.g. from wconn._wlink.id? or wlink.close should include its id itself?
// (or ._wlink._f.fd() ?)
error
err
,
eret
;
error
err
,
eret
;
auto
reterr1
=
[
&
eret
](
error
err
)
{
auto
reterr1
=
[
&
eret
](
error
err
)
{
...
@@ -241,6 +242,7 @@ error _Conn::__pin1(PinReq *req) {
...
@@ -241,6 +242,7 @@ error _Conn::__pin1(PinReq *req) {
FileH
f
;
FileH
f
;
bool
ok
;
bool
ok
;
// XXX deadlock wrt Conn.open which locks wconn.filehmu and starts initial "watch"
wconn
.
_filehmu
.
lock
();
wconn
.
_filehmu
.
lock
();
// XXX +incref f, so that simultaneous close does not remove f from wconn.filehTab ?
// XXX +incref f, so that simultaneous close does not remove f from wconn.filehTab ?
tie
(
f
,
ok
)
=
wconn
.
_filehtab
.
get_
(
req
->
foid
);
tie
(
f
,
ok
)
=
wconn
.
_filehtab
.
get_
(
req
->
foid
);
...
@@ -252,7 +254,7 @@ error _Conn::__pin1(PinReq *req) {
...
@@ -252,7 +254,7 @@ error _Conn::__pin1(PinReq *req) {
// XXX relock wconn -> f
// XXX relock wconn -> f
for
(
auto
mmap
:
f
->
_mmaps
)
{
// XXX
use ↑blk_start for binary search
for
(
auto
mmap
:
f
->
_mmaps
)
{
// TODO
use ↑blk_start for binary search
if
(
!
(
mmap
->
blk_start
<=
req
->
blk
&&
req
->
blk
<
mmap
->
blk_stop
()))
if
(
!
(
mmap
->
blk_start
<=
req
->
blk
&&
req
->
blk
<
mmap
->
blk_stop
()))
continue
;
// blk ∉ mmap
continue
;
// blk ∉ mmap
...
@@ -365,6 +367,8 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
...
@@ -365,6 +367,8 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
});
});
// start watching f
// start watching f
// XXX if we start watching with holding either wconn.filehMu or f.Mu, then
// the pinner will deadlock, trying to take wconn.filehMu or f.Mu
string
ack
;
string
ack
;
tie
(
ack
,
err
)
=
wconn
.
_wlink
->
sendReq
(
context
::
background
(),
fmt
::
sprintf
(
"watch %s @%s"
,
v
(
foid
),
v
(
wconn
.
at
)));
tie
(
ack
,
err
)
=
wconn
.
_wlink
->
sendReq
(
context
::
background
(),
fmt
::
sprintf
(
"watch %s @%s"
,
v
(
foid
),
v
(
wconn
.
at
)));
if
(
err
!=
nil
)
if
(
err
!=
nil
)
...
@@ -385,6 +389,8 @@ error _FileH::close() {
...
@@ -385,6 +389,8 @@ error _FileH::close() {
Conn
wconn
=
fileh
.
wconn
;
Conn
wconn
=
fileh
.
wconn
;
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: close f<%s>"
,
v
(
wconn
->
_wc
->
mountpoint
),
v
(
wconn
->
at
),
v
(
fileh
.
foid
));
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: close f<%s>"
,
v
(
wconn
->
_wc
->
mountpoint
),
v
(
wconn
->
at
),
v
(
fileh
.
foid
));
// XXX change all fileh.mmaps to cause EFAULT on any access after fileh.close
// remove fileh from wconn._filehtab
// remove fileh from wconn._filehtab
// fileh.close can be called several times and after first call another
// fileh.close can be called several times and after first call another
// fileh could be opened for the same foid. Be careful not to erase it.
// fileh could be opened for the same foid. Be careful not to erase it.
...
...
wcfs/client/wcfs.h
View file @
7a2b1dad
...
@@ -224,6 +224,7 @@ struct _FileH : object {
...
@@ -224,6 +224,7 @@ struct _FileH : object {
zodb
::
Oid
foid
;
// ZBigFile root object ID (does not change after fileh open)
zodb
::
Oid
foid
;
// ZBigFile root object ID (does not change after fileh open)
size_t
blksize
;
// block size of this file (does not change after fileh open)
size_t
blksize
;
// block size of this file (does not change after fileh open)
os
::
File
_headf
;
// file object of head/file
os
::
File
_headf
;
// file object of head/file
off_t
_headfsize
;
// head/file size is known to be at least headfsize (size ↑=)
off_t
_headfsize
;
// head/file size is known to be at least headfsize (size ↑=)
dict
<
int64_t
,
zodb
::
Tid
>
_pinned
;
// {} blk -> rev that wcfs already sent us for this file
dict
<
int64_t
,
zodb
::
Tid
>
_pinned
;
// {} blk -> rev that wcfs already sent us for this file
...
...
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