aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-11-17 20:32:19 +0100
committerJakob Unterwurzacher2016-11-17 20:32:19 +0100
commite04dc050126edcf7440ea5412bc74c6ad8b42e95 (patch)
tree56affe516cc83618152790582d0a8a6b2c870646 /internal/fusefrontend_reverse
parent081015aa746cc2a37284ad545d56d5ceb78164b6 (diff)
fusefrontend: upgrade wlockMap to use device AND inode number
If there are multiple filesystems backing the gocryptfs filesystems inode numbers are not guaranteed to be unique.
Diffstat (limited to 'internal/fusefrontend_reverse')
-rw-r--r--internal/fusefrontend_reverse/ino_map.go5
-rw-r--r--internal/fusefrontend_reverse/rfs.go6
2 files changed, 3 insertions, 8 deletions
diff --git a/internal/fusefrontend_reverse/ino_map.go b/internal/fusefrontend_reverse/ino_map.go
index 9412343..dae8222 100644
--- a/internal/fusefrontend_reverse/ino_map.go
+++ b/internal/fusefrontend_reverse/ino_map.go
@@ -17,8 +17,3 @@ type inoGenT struct {
func (i *inoGenT) next() uint64 {
return atomic.AddUint64(i.ino, 1)
}
-
-type devIno struct {
- dev uint64
- ino uint64
-}
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index 7f102cf..aca4b90 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -41,7 +41,7 @@ type ReverseFS struct {
// Inode number generator
inoGen *inoGenT
// Maps backing files device+inode pairs to user-facing unique inode numbers
- inoMap map[devIno]uint64
+ inoMap map[fusefrontend.DevInoStruct]uint64
// Protects map access
inoMapLock sync.Mutex
}
@@ -68,7 +68,7 @@ func NewFS(args fusefrontend.Args) *ReverseFS {
nameTransform: nameTransform,
contentEnc: contentEnc,
inoGen: newInoGen(),
- inoMap: map[devIno]uint64{},
+ inoMap: map[fusefrontend.DevInoStruct]uint64{},
}
}
@@ -167,7 +167,7 @@ func (rfs *ReverseFS) inoAwareStat(relPlainPath string) (*fuse.Attr, fuse.Status
// The file has hard links. We have to give it a stable inode number so
// tar or rsync can find them.
if fi.Mode().IsRegular() && st.Nlink > 1 {
- di := devIno{uint64(st.Dev), st.Ino}
+ di := fusefrontend.DevInoFromStat(st)
rfs.inoMapLock.Lock()
stableIno := rfs.inoMap[di]
if stableIno == 0 {