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
b45c5aaf
Commit
b45c5aaf
authored
Feb 21, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e8f67851
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+19
-5
No files found.
wcfs/client/wcfs.cpp
View file @
b45c5aaf
...
...
@@ -514,7 +514,7 @@ error _Conn::resync(zodb::Tid at) {
// TODO if file has no mappings and was not used during whole prev
// cycle - forget and stop watching it
// XXX not yet ready f
?
// XXX not yet ready f
// update f._headfsize and remmap to head/f zero regions that are now covered by head/f
struct
stat
st
;
...
...
@@ -618,7 +618,7 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
}
// create in-flight-opening FileH entry and perform open with wconn._mu released
// NOTE wconn._atMu
is still held because
open relies on wconn.at being stable.
// NOTE wconn._atMu
.R is still held because FileH._
open relies on wconn.at being stable.
f
=
adoptref
(
new
_FileH
());
f
->
wconn
=
newref
(
&
wconn
);
f
->
foid
=
foid
;
...
...
@@ -688,9 +688,8 @@ error _FileH::_open() {
tie
(
ack
,
err
)
=
wconn
->
_wlink
->
sendReq
(
context
::
background
(),
fmt
::
sprintf
(
"watch %s @%s"
,
v
(
foid
),
v
(
wconn
->
at
)));
if
(
err
!=
nil
)
return
err
;
if
(
ack
!=
"ok"
)
{
if
(
ack
!=
"ok"
)
return
fmt
::
errorf
(
"watch: %s"
,
v
(
ack
));
}
retok
=
true
;
return
nil
;
...
...
@@ -702,10 +701,25 @@ error _FileH::_open() {
error
_FileH
::
close
()
{
_FileH
&
fileh
=
*
this
;
Conn
wconn
=
fileh
.
wconn
;
// XXX locking ok?
wconn
->
_atMu
.
RLock
();
defer
([
&
]()
{
wconn
->
_atMu
.
RUnlock
();
});
xerr
::
Contextf
E
(
"%s: close f<%s>"
,
v
(
wconn
),
v
(
fileh
.
foid
));
// XXX change all fileh.mmaps to cause EFAULT on any access after fileh.close
// XXX "watch foid -" -> wconn.wlink (stop watching the file)
// stop watching f
string
ack
;
error
err
;
tie
(
ack
,
err
)
=
wconn
->
_wlink
->
sendReq
(
context
::
background
(),
fmt
::
sprintf
(
"watch %s -"
,
v
(
foid
)));
if
(
err
!=
nil
)
return
E
(
err
);
if
(
ack
!=
"ok"
)
return
E
(
fmt
::
errorf
(
"unwatch: %s"
,
v
(
ack
)));
// remove fileh from wconn._filehTab
// fileh.close can be called several times and after first call another
...
...
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