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
cf77198f
Commit
cf77198f
authored
Mar 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a41fe05a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+13
-13
No files found.
wcfs/client/wcfs.cpp
View file @
cf77198f
...
@@ -145,11 +145,11 @@
...
@@ -145,11 +145,11 @@
//
//
// XXX pinner takes the following locks (XXX recheck)
// XXX pinner takes the following locks (XXX recheck)
//
//
// - wconn.
m
u.W
// - wconn.
filehM
u.W
// - wconn.
m
u.R
// - wconn.
filehM
u.R
//
//
// - wconn.atMu.R
// - wconn.atMu.R
// - wconn.
m
u.R
// - wconn.
filehM
u.R
// - fileh.mu (R:.mmaps W:.pinned)
// - fileh.mu (R:.mmaps W:.pinned)
//
//
// - virt_lock
// - virt_lock
...
@@ -264,7 +264,7 @@ error _Conn::close() {
...
@@ -264,7 +264,7 @@ error _Conn::close() {
if
(
alreadyClosed
)
if
(
alreadyClosed
)
return
nil
;
return
nil
;
// close wlink and signal to pinner to stop outside of wconn.
m
u
// close wlink and signal to pinner to stop outside of wconn.
filehM
u
err
=
wconn
.
_wlink
->
close
();
// XXX ok under atMu?
err
=
wconn
.
_wlink
->
close
();
// XXX ok under atMu?
if
(
err
!=
nil
)
if
(
err
!=
nil
)
reterr1
(
err
);
reterr1
(
err
);
...
@@ -317,7 +317,7 @@ error _Conn::_pinner(context::Context ctx) {
...
@@ -317,7 +317,7 @@ error _Conn::_pinner(context::Context ctx) {
}
}
// mark the connection non-operational if the pinner fails
// mark the connection non-operational if the pinner fails
// XXX deadlock wrt resync? (who read-locks wconn.
m
u)
// XXX deadlock wrt resync? (who read-locks wconn.
filehM
u)
// XXX -> mu -> downMu ?
// XXX -> mu -> downMu ?
wconn
.
_filehMu
.
Lock
();
// XXX locking ok? -> merge into below where lock is held?
wconn
.
_filehMu
.
Lock
();
// XXX locking ok? -> merge into below where lock is held?
if
(
wconn
.
_downErr
==
nil
)
{
if
(
wconn
.
_downErr
==
nil
)
{
...
@@ -387,7 +387,7 @@ error _Conn::__pin1(PinReq *req) {
...
@@ -387,7 +387,7 @@ error _Conn::__pin1(PinReq *req) {
wconn
.
_atMu
.
RUnlock
();
wconn
.
_atMu
.
RUnlock
();
});
});
// XXX deadlock wrt Conn.resync which locks wconn.
m
u and does "watch" ?
// XXX deadlock wrt Conn.resync which locks wconn.
filehM
u and does "watch" ?
wconn
.
_filehMu
.
RLock
();
wconn
.
_filehMu
.
RLock
();
// 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 ?
// XXX or just make FileH.close lock f too to synchronize with pinner?
// XXX or just make FileH.close lock f too to synchronize with pinner?
...
@@ -400,7 +400,7 @@ error _Conn::__pin1(PinReq *req) {
...
@@ -400,7 +400,7 @@ error _Conn::__pin1(PinReq *req) {
// XXX <- f._openReady ?
// XXX <- f._openReady ?
wconn
.
_filehMu
.
RUnlock
();
// XXX maybe `f.mu.lock() -> wconn.
m
u.unlock()` to avoid race with FileH close?
wconn
.
_filehMu
.
RUnlock
();
// XXX maybe `f.mu.lock() -> wconn.
filehM
u.unlock()` to avoid race with FileH close?
f
->
_mu
.
lock
();
f
->
_mu
.
lock
();
defer
([
&
]()
{
defer
([
&
]()
{
f
->
_mu
.
unlock
();
f
->
_mu
.
unlock
();
...
@@ -511,7 +511,7 @@ error _Conn::resync(zodb::Tid at) {
...
@@ -511,7 +511,7 @@ error _Conn::resync(zodb::Tid at) {
// set new wconn.at early, so that e.g. Conn.open running simultaneously
// set new wconn.at early, so that e.g. Conn.open running simultaneously
// to second part of resync (see below) uses new at.
// to second part of resync (see below) uses new at.
// XXX no need since wconn._filehMu is locked? -> no - it is *needed* after wconn.
m
u became RWMutex
// XXX no need since wconn._filehMu is locked? -> no - it is *needed* after wconn.
filehM
u became RWMutex
wconn
.
at
=
at
;
wconn
.
at
=
at
;
// go through all files opened under wconn and pre-adjust their mappings
// go through all files opened under wconn and pre-adjust their mappings
...
@@ -707,9 +707,9 @@ retry:
...
@@ -707,9 +707,9 @@ retry:
// _open performs actual open of FileH marked as "in-flight-open" in wconn.filehTab.
// _open performs actual open of FileH marked as "in-flight-open" in wconn.filehTab.
//
//
// Called with:
// Called with:
// - wconn.atMu held
// - wconn.atMu
held
// - wconn.
mu
not locked
// - wconn.
filehMu
not locked
// - f.mu not locked
// - f.mu
not locked
error
_FileH
::
_open
()
{
error
_FileH
::
_open
()
{
_FileH
*
f
=
this
;
_FileH
*
f
=
this
;
Conn
wconn
=
f
->
wconn
;
Conn
wconn
=
f
->
wconn
;
...
@@ -737,7 +737,7 @@ error _FileH::_open() {
...
@@ -737,7 +737,7 @@ error _FileH::_open() {
v
(
f
->
_headf
->
name
()),
f
->
_headfsize
,
f
->
blksize
);
v
(
f
->
_headf
->
name
()),
f
->
_headfsize
,
f
->
blksize
);
// start watching f
// start watching f
// NOTE we are _not_ holding wconn.
m
u nor f.mu - only wconn.atMu to rely on wconn.at being stable.
// NOTE we are _not_ holding wconn.
filehM
u nor f.mu - only wconn.atMu to rely on wconn.at being stable.
// NOTE wcfs will reply "ok" only after wcfs/head/at ≥ wconn.at
// NOTE wcfs will reply "ok" only after wcfs/head/at ≥ wconn.at
string
ack
;
string
ack
;
// XXX f._watchMu.lock() + unlock ?
// XXX f._watchMu.lock() + unlock ?
...
@@ -783,7 +783,7 @@ error _FileH::close() {
...
@@ -783,7 +783,7 @@ error _FileH::close() {
ASSERT
(
fileh
.
_state
==
_FileHOpened
);
// there can be no open-in-progress, because
ASSERT
(
fileh
.
_state
==
_FileHOpened
);
// there can be no open-in-progress, because
fileh
.
_state
=
_FileHClosing
;
// .close() can be called only on "opened" fileh
fileh
.
_state
=
_FileHClosing
;
// .close() can be called only on "opened" fileh
// unlock wconn.
m
u to stop watching outside of this lock.
// unlock wconn.
_filehM
u to stop watching outside of this lock.
// we'll relock it again before updating wconn.filehTab.
// we'll relock it again before updating wconn.filehTab.
wconn
->
_filehMu
.
Unlock
();
wconn
->
_filehMu
.
Unlock
();
...
...
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