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
c3e1d21f
Commit
c3e1d21f
authored
Mar 04, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
be061f93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+19
-6
No files found.
wcfs/client/wcfs.cpp
View file @
c3e1d21f
...
@@ -301,20 +301,32 @@ error _Conn::close() {
...
@@ -301,20 +301,32 @@ error _Conn::close() {
// mappings to give EFAULT on access.
// mappings to give EFAULT on access.
while
(
1
)
{
while
(
1
)
{
FileH
f
=
nil
;
FileH
f
=
nil
;
bool
opening
,
closing
;
// pick up any fileh
// pick up any fileh
wconn
.
_filehMu
.
Lock
();
wconn
.
_filehMu
.
Lock
();
if
(
!
wconn
.
_filehTab
.
empty
())
if
(
!
wconn
.
_filehTab
.
empty
())
{
f
=
wconn
.
_filehTab
.
begin
()
->
second
;
f
=
wconn
.
_filehTab
.
begin
()
->
second
;
opening
=
(
f
->
_state
<
_FileHOpened
);
closing
=
(
f
->
_state
>=
_FileHClosing
);
if
(
!
closing
)
f
->
_nopen
++
;
// the file is not closing - we'll close it ourselves.
}
wconn
.
_filehMu
.
Unlock
();
wconn
.
_filehMu
.
Unlock
();
if
(
f
==
nil
)
if
(
f
==
nil
)
break
;
// all closed
break
;
// all closed
// XXX vvv only for !opening state
// if fileh was "opening" - wait for the open to complete before calling close.
if
(
opening
)
{
f
->
_openReady
.
recv
();
if
(
f
->
_openErr
!=
nil
)
continue
;
// failed open; f should be removed from wconn._filehTab by Conn.open itself
}
// close f under
// if fileh was not "closing" - close it ourselves (we pretended we opened it too).
// - XXX virt_lock
// call close f under
// - virt_lock
// - wconn.atMu.R
// - wconn.atMu.R
// - wconn.filehMu unlocked
// - wconn.filehMu unlocked
err
=
f
->
_closeLocked
();
err
=
f
->
_closeLocked
();
...
@@ -322,7 +334,8 @@ error _Conn::close() {
...
@@ -322,7 +334,8 @@ error _Conn::close() {
reterr1
(
err
);
reterr1
(
err
);
// wait for f close to complete, as it might be that f.close was called
// wait for f close to complete, as it might be that f.close was called
// simultaneously to wconn.close
// simultaneously to us or just before. f is removed from
// wconn.filehTab only after close completes.
f
->
_closedq
.
recv
();
f
->
_closedq
.
recv
();
}
}
...
@@ -760,6 +773,7 @@ retry:
...
@@ -760,6 +773,7 @@ retry:
bool
retok
=
false
;
bool
retok
=
false
;
wconn
.
_filehTab
[
foid
]
=
f
;
wconn
.
_filehTab
[
foid
]
=
f
;
wconn
.
_filehMu
.
Unlock
();
defer
([
&
]()
{
defer
([
&
]()
{
wconn
.
_filehMu
.
Lock
();
wconn
.
_filehMu
.
Lock
();
if
(
wconn
.
_filehTab
.
get
(
foid
)
!=
f
)
{
if
(
wconn
.
_filehTab
.
get
(
foid
)
!=
f
)
{
...
@@ -775,7 +789,6 @@ retry:
...
@@ -775,7 +789,6 @@ retry:
wconn
.
_filehMu
.
Unlock
();
wconn
.
_filehMu
.
Unlock
();
f
->
_openReady
.
close
();
f
->
_openReady
.
close
();
});
});
wconn
.
_filehMu
.
Unlock
();
// do the actuall open.
// do the actuall open.
// we hold only wconn.atMu.R, but niether wconn.filehMu, nor f.mu .
// we hold only wconn.atMu.R, but niether wconn.filehMu, nor f.mu .
...
...
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