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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
60194645
Commit
60194645
authored
Jul 01, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
25ba5b0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
wcfs/wcfs.go
wcfs/wcfs.go
+24
-15
No files found.
wcfs/wcfs.go
View file @
60194645
...
@@ -692,15 +692,17 @@ func traceZWatch(format string, argv ...interface{}) {
...
@@ -692,15 +692,17 @@ func traceZWatch(format string, argv ...interface{}) {
// zwatcher watches for ZODB changes.
// zwatcher watches for ZODB changes.
//
//
// see "4) when we receive an invalidation message from ZODB ..."
// see "4) when we receive an invalidation message from ZODB ..."
/*
func (root *Root) zwatcher(ctx context.Context, zwatchq chan zodb.Event) {
func (root *Root) zwatcher(ctx context.Context, zwatchq chan zodb.Event) {
err := root._zwatcher(ctx, zwatchq)
err := root._zwatcher(ctx, zwatchq)
if err != nil {
if err != nil {
panic(err) // XXX -> wg.Wait in main
panic(err) // XXX -> wg.Wait in main
}
}
}
}
*/
func
(
root
*
Root
)
_
zwatcher
(
ctx
context
.
Context
,
zwatchq
chan
zodb
.
Event
)
(
err
error
)
{
func
(
root
*
Root
)
zwatcher
(
ctx
context
.
Context
,
zwatchq
chan
zodb
.
Event
)
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"zwatch %s"
,
root
.
zstor
.
URL
())
defer
xerr
.
Contextf
(
&
err
,
"zwatch %s"
,
root
.
zstor
.
URL
())
// XXX err ctx recheck
// XXX error -> always EIO for data operations
// XXX error -> always EIO for data operations
// XXX unmount -> stop
// XXX unmount -> stop
traceZWatch
(
">>>"
)
traceZWatch
(
">>>"
)
...
@@ -2163,7 +2165,7 @@ func _main() (err error) {
...
@@ -2163,7 +2165,7 @@ func _main() (err error) {
NoPool
:
true
,
NoPool
:
true
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
return
err
}
}
zhead
.
Cache
()
.
Lock
()
zhead
.
Cache
()
.
Lock
()
zhead
.
Cache
()
.
SetControl
(
&
zodbCacheControl
{})
zhead
.
Cache
()
.
SetControl
(
&
zodbCacheControl
{})
...
@@ -2220,7 +2222,7 @@ func _main() (err error) {
...
@@ -2220,7 +2222,7 @@ func _main() (err error) {
fssrv
,
fsconn
,
err
:=
mount
(
mntpt
,
root
,
opts
)
fssrv
,
fsconn
,
err
:=
mount
(
mntpt
,
root
,
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
return
err
}
}
groot
=
root
// FIXME temp workaround (see ^^^)
groot
=
root
// FIXME temp workaround (see ^^^)
gfsconn
=
fsconn
// FIXME ----//----
gfsconn
=
fsconn
// FIXME ----//----
...
@@ -2231,7 +2233,7 @@ func _main() (err error) {
...
@@ -2231,7 +2233,7 @@ func _main() (err error) {
kfuse
:=
fmt
.
Sprintf
(
"kernel FUSE (API %d.%d)"
,
kinit
.
Major
,
kinit
.
Minor
)
kfuse
:=
fmt
.
Sprintf
(
"kernel FUSE (API %d.%d)"
,
kinit
.
Major
,
kinit
.
Minor
)
supports
:=
kinit
.
SupportsNotify
supports
:=
kinit
.
SupportsNotify
if
!
(
supports
(
fuse
.
NOTIFY_STORE_CACHE
)
&&
supports
(
fuse
.
NOTIFY_RETRIEVE_CACHE
))
{
if
!
(
supports
(
fuse
.
NOTIFY_STORE_CACHE
)
&&
supports
(
fuse
.
NOTIFY_RETRIEVE_CACHE
))
{
log
.
Fatal
f
(
"%s does not support pagecache control"
,
kfuse
)
return
fmt
.
Error
f
(
"%s does not support pagecache control"
,
kfuse
)
}
}
// make a bold warning if kernel does not support explicit cache invalidation
// make a bold warning if kernel does not support explicit cache invalidation
// (patch sent upstream; see notes.txt -> "Notes on OS pagecache control")
// (patch sent upstream; see notes.txt -> "Notes on OS pagecache control")
...
@@ -2265,32 +2267,39 @@ func _main() (err error) {
...
@@ -2265,32 +2267,39 @@ func _main() (err error) {
fsNode
:
newFSNode
(
fSticky
),
fsNode
:
newFSNode
(
fSticky
),
})
})
// XXX place = ok?
// XXX ctx = ok? XXX -> joined ctx for fs.Serve + zwatcher ?
// XXX wait for zwatcher shutdown + log from it error
go
root
.
zwatcher
(
ctx
,
zwatchq
)
// TODO handle autoexit
// TODO handle autoexit
// (exit when kernel forgets all our inodes - wcfs.py keeps .wcfs/zurl
// (exit when kernel forgets all our inodes - wcfs.py keeps .wcfs/zurl
// opened, so when all inodes has been forgotten - we know all wcfs.py clients exited)
// opened, so when all inodes has been forgotten - we know all wcfs.py clients exited)
_
=
autoexit
_
=
autoexit
// s
erve client requests
.
// s
pawn filesystem server
.
//
//
// use `go serve` + `waitMount` not just `serve` - because waitMount
// use `go serve` + `waitMount` not just `serve` - because waitMount
// cares to disable OS calling poll on us.
// cares to disable OS calling poll on us.
// ( if we don't disable polling - fs serving can get stuck - see
// ( if we don't disable polling - fs serving can get stuck - see
// https://github.com/hanwen/go-fuse/commit/4f10e248eb for details )
// https://github.com/hanwen/go-fuse/commit/4f10e248eb for details )
done
:=
make
(
chan
struct
{}
)
serveCtx
,
serveCancel
:=
context
.
WithCancel
(
context
.
Background
()
)
go
func
()
{
go
func
()
{
defer
serveCancel
()
fssrv
.
Serve
()
fssrv
.
Serve
()
close
(
done
)
}()
}()
err
=
fssrv
.
WaitMount
()
err
=
fssrv
.
WaitMount
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
// XXX err ctx?
return
err
// XXX err ctx?
}
// filesystem server is serving requests.
// run zwatcher and wait for it to complete.
// zwatcher completes either normally - due to filesystem unmount, or fails.
// if zwatcher fails - switch filesystem to return EIO instead of stale data.
err
=
root
.
zwatcher
(
serveCtx
,
zwatchq
)
if
errors
.
Cause
(
err
)
!=
context
.
Canceled
{
log
.
Error
(
err
)
log
.
Errorf
(
"-> switching filesystem to EIO mode"
)
// XXX switch fs to EIO mode
}
}
<-
done
// wait for unmount
<-
serveCtx
.
Done
()
return
nil
return
nil
}
}
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