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
22769012
Commit
22769012
authored
Jul 04, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5f21e010
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
wcfs/wcfs.go
wcfs/wcfs.go
+15
-8
No files found.
wcfs/wcfs.go
View file @
22769012
...
@@ -977,11 +977,11 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
...
@@ -977,11 +977,11 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
func
()
{
func
()
{
// store retrieved data back to OS cache for file @<rev>/file[blk]
// store retrieved data back to OS cache for file @<rev>/file[blk]
blkrev
,
_
:=
f
.
LastBlkRev
(
ctx
,
blk
,
f
.
head
.
zconn
.
At
())
blkrev
,
_
:=
f
.
LastBlkRev
(
ctx
,
blk
,
f
.
head
.
zconn
.
At
())
frev
,
f
release
,
err
:=
groot
.
mkrevf
ile
(
blkrev
,
f
.
zfile
.
POid
())
frev
,
f
unlock
,
err
:=
groot
.
lockRevF
ile
(
blkrev
,
f
.
zfile
.
POid
())
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Errorf
(
"BUG: %s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)"
,
f
.
path
(),
blk
,
err
)
log
.
Errorf
(
"BUG: %s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)"
,
f
.
path
(),
blk
,
err
)
}
}
defer
f
release
()
defer
f
unlock
()
st
:=
fsconn
.
FileNotifyStoreCache
(
frev
.
Inode
(),
off
,
blkdata
)
st
:=
fsconn
.
FileNotifyStoreCache
(
frev
.
Inode
(),
off
,
blkdata
)
if
st
!=
fuse
.
OK
{
if
st
!=
fuse
.
OK
{
...
@@ -1014,27 +1014,34 @@ func (f *BigFile) invalidateAttr() (err error) {
...
@@ -1014,27 +1014,34 @@ func (f *BigFile) invalidateAttr() (err error) {
}
}
// mkrevfile makes sure inode ID of /@<rev>/bigfile/<fid> is known to kernel.
// lockRevFile makes sure inode ID of /@<rev>/bigfile/<fid> is known to kernel
// and won't change until unlock.
//
//
// We need node ID to be know to the kernel, when we need to store data into
// We need node ID to be know to the kernel, when we need to store data into
// file's kernel cache - if the kernel don't have the node ID for the file in
// file's kernel cache - if the kernel don't have the node ID for the file in
// question, FileNotifyStoreCache will just fail.
// question, FileNotifyStoreCache will just fail.
//
//
// For kernel to know the inode
mkrevf
ile issues regular filesystem lookup
// For kernel to know the inode
lockRevF
ile issues regular filesystem lookup
// request which goes to kernel and should go back to wcfs. It is thus not safe
// request which goes to kernel and should go back to wcfs. It is thus not safe
// to use
mkrevf
ile from under FUSE request handler as doing so might deadlock.
// to use
lockRevF
ile from under FUSE request handler as doing so might deadlock.
//
//
// Caller must call release when inode ID is no longer required to be present.
// Caller must call unlock when inode ID is no longer required to be present.
func
(
root
*
Root
)
mkrevfile
(
rev
zodb
.
Tid
,
fid
zodb
.
Oid
)
(
_
*
BigFile
,
release
func
(),
err
error
)
{
// It is safe to simultaneously call multiple lockRevFile with the same arguments.
func
(
root
*
Root
)
lockRevFile
(
rev
zodb
.
Tid
,
fid
zodb
.
Oid
)
(
_
*
BigFile
,
unlock
func
(),
err
error
)
{
fsconn
:=
gfsconn
fsconn
:=
gfsconn
frevpath
:=
fmt
.
Sprintf
(
"@%s/bigfile/%s"
,
rev
,
fid
)
// relative to fs root for now
frevpath
:=
fmt
.
Sprintf
(
"@%s/bigfile/%s"
,
rev
,
fid
)
// relative to fs root for now
defer
xerr
.
Contextf
(
&
err
,
"/:
mkrevf
ile %s"
,
frevpath
)
defer
xerr
.
Contextf
(
&
err
,
"/:
lockRevF
ile %s"
,
frevpath
)
// FIXME checking for "node{0}" is fragile:
// FIXME checking for "node{0}" is fragile:
// XXX the node could be still forgotten since we are not holding open on it
// XXX the node could be still forgotten since we are not holding open on it
// XXX -> always os.open unconditionally for now
// XXX -> always os.open unconditionally for now
// or is it ok since it is just a cache?
// or is it ok since it is just a cache?
// -> no, not ok: if inode ID is forgotten, the same ID could be
// reallocated to another file and then we'll corrupt in-kernel
// cache by wrongly storing data of one file into cache of
// another file.
// -> to avoid this we need to always lock the inode ID with real open.
// XXX (also disabled for now due to race-detector)
// XXX (also disabled for now due to race-detector)
/*
/*
// first check without going through kernel, whether the inode maybe known already
// first check without going through kernel, whether the inode maybe known already
...
...
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