Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
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
Levin Zimmermann
go-fuse
Commits
0eb229fd
Commit
0eb229fd
authored
Aug 02, 2014
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't hold locks while unmounting zip FS.
parent
c29cdc95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
11 deletions
+31
-11
zipfs/multizip.go
zipfs/multizip.go
+31
-11
No files found.
zipfs/multizip.go
View file @
0eb229fd
...
...
@@ -32,6 +32,9 @@ type MultiZipFs struct {
zips
map
[
string
]
nodefs
.
Node
dirZipFileMap
map
[
string
]
string
// zip files that we are in the process of unmounting.
zombie
map
[
string
]
bool
nodeFs
*
pathfs
.
PathNodeFs
pathfs
.
FileSystem
}
...
...
@@ -39,6 +42,7 @@ type MultiZipFs struct {
func
NewMultiZipFs
()
*
MultiZipFs
{
m
:=
&
MultiZipFs
{
zips
:
make
(
map
[
string
]
nodefs
.
Node
),
zombie
:
make
(
map
[
string
]
bool
),
dirZipFileMap
:
make
(
map
[
string
]
string
),
FileSystem
:
pathfs
.
NewDefaultFileSystem
(),
}
...
...
@@ -116,19 +120,30 @@ func (fs *MultiZipFs) Unlink(name string, context *fuse.Context) (code fuse.Stat
if
dir
==
CONFIG_PREFIX
{
fs
.
lock
.
Lock
()
defer
fs
.
lock
.
Unlock
()
if
fs
.
zombie
[
basename
]
{
return
fuse
.
ENOENT
}
root
,
ok
:=
fs
.
zips
[
basename
]
if
ok
{
code
=
fs
.
nodeFs
.
UnmountNode
(
root
.
Inode
())
if
!
code
.
Ok
()
{
return
code
}
delete
(
fs
.
zips
,
basename
)
delete
(
fs
.
dirZipFileMap
,
basename
)
return
fuse
.
OK
}
else
{
if
!
ok
{
return
fuse
.
ENOENT
}
name
:=
fs
.
dirZipFileMap
[
basename
]
fs
.
zombie
[
basename
]
=
true
delete
(
fs
.
zips
,
basename
)
delete
(
fs
.
dirZipFileMap
,
basename
)
// Drop lock to ensure that notify doesn't cause deadlock.
fs
.
lock
.
Unlock
()
code
=
fs
.
nodeFs
.
UnmountNode
(
root
.
Inode
())
fs
.
lock
.
Lock
()
delete
(
fs
.
zombie
,
basename
)
if
!
code
.
Ok
()
{
// Failed: reinstate
fs
.
zips
[
basename
]
=
root
fs
.
dirZipFileMap
[
basename
]
=
name
}
return
code
}
return
fuse
.
EPERM
}
...
...
@@ -141,7 +156,9 @@ func (fs *MultiZipFs) Readlink(path string, context *fuse.Context) (val string,
fs
.
lock
.
Lock
()
defer
fs
.
lock
.
Unlock
()
if
fs
.
zombie
[
base
]
{
return
""
,
fuse
.
ENOENT
}
zipfile
,
ok
:=
fs
.
dirZipFileMap
[
base
]
if
!
ok
{
return
""
,
fuse
.
ENOENT
...
...
@@ -157,6 +174,9 @@ func (fs *MultiZipFs) Symlink(value string, linkName string, context *fuse.Conte
fs
.
lock
.
Lock
()
defer
fs
.
lock
.
Unlock
()
if
fs
.
zombie
[
base
]
{
return
fuse
.
EBUSY
}
_
,
ok
:=
fs
.
dirZipFileMap
[
base
]
if
ok
{
...
...
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