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
6adc53bd
Commit
6adc53bd
authored
Jun 27, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a6874733
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
wcfs/notes.txt
wcfs/notes.txt
+7
-7
wcfs/wcfs.go
wcfs/wcfs.go
+10
-3
wcfs/δftail.go
wcfs/δftail.go
+1
-1
No files found.
wcfs/notes.txt
View file @
6adc53bd
...
@@ -180,22 +180,22 @@ if we try to upload data to kernel pagecache from under serving read request,
...
@@ -180,22 +180,22 @@ if we try to upload data to kernel pagecache from under serving read request,
this can deadlock.
this can deadlock.
Another case that needs to be cared about is interaction between uploadBlk and
Another case that needs to be cared about is interaction between uploadBlk and
zwatcher: z
conn
Mu being RWMutex, does not allow new RLocks to be taken once
zwatcher: z
head
Mu being RWMutex, does not allow new RLocks to be taken once
Lock request has been issued. Thus the following scenario is possible::
Lock request has been issued. Thus the following scenario is possible::
uploadBlk os.Read zwatcher
uploadBlk os.Read zwatcher
page.Lock
page.Lock
z
conn
Mu.Rlock
z
head
Mu.Rlock
z
conn
Mu.Lock
z
head
Mu.Lock
page.Lock
page.Lock
z
conn
Mu.Rlock
z
head
Mu.Rlock
- zwatcher is waiting for uploadBlk to release z
conn
Mu;
- zwatcher is waiting for uploadBlk to release z
head
Mu;
- uploadBlk is waiting for os.Read to release page;
- uploadBlk is waiting for os.Read to release page;
- os.Read is waiting for zwatcher to release z
conn
Mu;
- os.Read is waiting for zwatcher to release z
head
Mu;
- deadlock.
- deadlock.
To avoid such deadlocks zwatcher asks OS cache uploaders to pause while it is
To avoid such deadlocks zwatcher asks OS cache uploaders to pause while it is
running, and retries taking z
conn
Mu.Lock until all uploaders are indeed paused.
running, and retries taking z
head
Mu.Lock until all uploaders are indeed paused.
wcfs/wcfs.go
View file @
6adc53bd
...
@@ -310,8 +310,6 @@ package main
...
@@ -310,8 +310,6 @@ package main
// 4.6) processing ZODB invalidations and serving file reads (see 7) are
// 4.6) processing ZODB invalidations and serving file reads (see 7) are
// organized to be mutually exclusive.
// organized to be mutually exclusive.
//
//
// (TODO head.zheadMu -> special mutex with Lock(ctx) so that Lock could be canceled)
//
// 5) after OS file cache was invalidated, we resync zhead to new database
// 5) after OS file cache was invalidated, we resync zhead to new database
// view corresponding to tid.
// view corresponding to tid.
//
//
...
@@ -489,7 +487,7 @@ type Head struct {
...
@@ -489,7 +487,7 @@ type Head struct {
// ZODB connection for everything under this head
// ZODB connection for everything under this head
// zheadMu protects
access to zconn
& live _objects_ associated with it.
// zheadMu protects
zconn.At
& live _objects_ associated with it.
// while it is rlocked zconn is guaranteed to stay viewing database at
// while it is rlocked zconn is guaranteed to stay viewing database at
// particular view.
// particular view.
//
//
...
@@ -665,6 +663,15 @@ func (_ *zodbCacheControl) PCacheClassify(obj zodb.IPersistent) zodb.PCachePolic
...
@@ -665,6 +663,15 @@ func (_ *zodbCacheControl) PCacheClassify(obj zodb.IPersistent) zodb.PCachePolic
return
0
return
0
}
}
// -------- zhead lock/wait --------
// TODO head.zheadMu -> special mutex with Lock(ctx) so that Lock wait could be canceled
func
(
head
*
Head
)
zheadRLock
()
{
head
.
zheadMu
.
RLock
()
}
func
(
head
*
Head
)
zheadRUnlock
()
{
head
.
zheadMu
.
RUnlock
()
}
func
(
head
*
Head
)
zheadLock
()
{
head
.
zheadMu
.
Lock
()
}
func
(
head
*
Head
)
zheadUnlock
()
{
head
.
zheadMu
.
Unlock
()
}
// -------- 4) ZODB invalidation -> OS cache --------
// -------- 4) ZODB invalidation -> OS cache --------
func
traceZWatch
(
format
string
,
argv
...
interface
{})
{
func
traceZWatch
(
format
string
,
argv
...
interface
{})
{
...
...
wcfs/δftail.go
View file @
6adc53bd
...
@@ -230,7 +230,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
...
@@ -230,7 +230,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
switch
obj
:=
obj
.
(
type
)
{
switch
obj
:=
obj
.
(
type
)
{
case
zBlk
:
// ZBlk*
case
zBlk
:
// ZBlk*
// z.infile locking: since we write-locked head.z
conn
Mu
// z.infile locking: since we write-locked head.z
head
Mu
// - no other fuse reads are running, and thus no one
// - no other fuse reads are running, and thus no one
// is mutating z.infile. XXX recheck
// is mutating z.infile. XXX recheck
z
:=
obj
.
inΔFtail
()
z
:=
obj
.
inΔFtail
()
...
...
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