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
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
Joshua
wendelin.core
Commits
82a68675
Commit
82a68675
authored
Mar 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e471cb59
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+8
-4
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+1
-1
No files found.
wcfs/client/wcfs.cpp
View file @
82a68675
...
...
@@ -486,7 +486,7 @@ error _Conn::resync(zodb::Tid at) {
//
// NOTE we'll relock atMu as R in the second part of resync, so we prelock
// wconn._filehMu.R as well while under atMu.W, to be sure that set of opened
// files
stays
the same during whole resync.
// files
and their states stay
the same during whole resync.
bool
atMuWLocked
=
true
;
wconn
.
_atMu
.
Lock
();
wconn
.
_filehMu
.
RLock
();
...
...
@@ -529,7 +529,10 @@ 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
// opening or closing fileh, whose setup/teardown is handled by
// Conn.open and FileH.close correspondingly.
if
(
f
.
_state
!=
_FileHOpened
)
continue
;
// update f._headfsize and remmap to head/f zero regions that are now covered by head/f
struct
stat
st
;
...
...
@@ -569,7 +572,8 @@ error _Conn::resync(zodb::Tid at) {
// - we need to hold atMu.R to avoid race wrt e.g. other resync which changes at.
// - we cannot just do regular `atMu.Unlock + atMu.RLock()` because then
// there is e.g. a race window in between Unlock and RLock where wconn.at can be changed.
// XXX also deadlock, because it will become wconn._filehMu.lock + wconn._atMu lock
// Also if we Unlock and Rlock, it will produce deadlock, because locking
// order will change to reverse: wconn._filehMu.R + wconn._atMu.R
//
// Now other calls, e.g. Conn.open, can be running simultaneously to us,
// but since we already set wconn.at to new value it is ok. For example
...
...
@@ -663,7 +667,7 @@ retry:
return
make_pair
(
f
,
nil
);
}
// create "opening" FileH entry and perform open with wconn._filehMu released
// create "opening" FileH entry and perform open with wconn._filehMu released
.
// NOTE wconn._atMu.R is still held because FileH._open relies on wconn.at being stable.
f
=
adoptref
(
new
_FileH
());
f
->
wconn
=
newref
(
&
wconn
);
...
...
wcfs/client/wcfs.h
View file @
82a68675
...
...
@@ -231,7 +231,7 @@ struct _FileH : object {
Conn
wconn
;
zodb
::
Oid
foid
;
// ZBigFile root object ID (does not change after fileh open)
// protect by wconn.filehMu
// protect by wconn.
_
filehMu
_FileHState
_state
;
// opening/opened/closing/closed
int
_nopen
;
// number of times Conn.open returned this fileh
...
...
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