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
8337bde5
Commit
8337bde5
authored
Mar 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1afd27a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+14
-7
No files found.
wcfs/client/wcfs.cpp
View file @
8337bde5
...
...
@@ -385,22 +385,29 @@ error _Conn::__pin1(PinReq *req) {
wconn
.
_atMu
.
RUnlock
();
});
// lock wconn.filehMu.R to lookup fileh in wconn.filehTab.
// keep wconn.filehMu.R during whole __pin1 to make sure that e.g.
// simultaneous close does not remove f from wconn.filehTab.
// TODO keeping filehMu.R during whole pin is not needed and locking can be made more granular.
//
// NOTE no deadlock wrt Conn.resync, Conn.open, FileH.close - they all send
// "watch" outside of wconn.filehMu.
wconn
.
_filehMu
.
RLock
();
// 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 keep wconn._filehMu.R during whole __pin1()
defer
([
&
]()
{
wconn
.
_filehMu
.
RUnlock
();
});
tie
(
f
,
ok
)
=
wconn
.
_filehTab
.
get_
(
req
->
foid
);
if
(
!
ok
)
{
wconn
.
_filehMu
.
RUnlock
();
// why wcfs sent us this update?
return
fmt
::
errorf
(
"unexpected pin: f<%s> not watched"
,
v
(
req
->
foid
));
}
// XXX <- f._openReady ?
// NOTE no need to check f._state as we need to go only through f.mmaps, and
// wcfs server can send us pins at any state, including "opening" - to pin
// our view to requested @at, and "closing" - due to other clients
// accessing wcfs/head/f simultaneously.
wconn
.
_filehMu
.
RUnlock
();
// XXX maybe `f.mu.lock() -> wconn.filehMu.unlock()` to avoid race with FileH close?
f
->
_mu
.
lock
();
defer
([
&
]()
{
f
->
_mu
.
unlock
();
...
...
@@ -447,7 +454,7 @@ error _Conn::__pin1(PinReq *req) {
if
(
err
!=
nil
)
return
err
;
//trace("\t-> remmaped");
XXX
//trace("\t-> remmaped");
}
// update f._pinned
...
...
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