Merge pull request #2584 from greatroar/mount-cache-uid-gid

Cache uid and gid for top directories in internal/fuse
This commit is contained in:
MichaelEischer
2020-04-18 17:45:14 +02:00
committed by GitHub
5 changed files with 64 additions and 32 deletions
+8
View File
@@ -6,6 +6,7 @@
package fuse
import (
"os"
"time"
"github.com/restic/restic/internal/debug"
@@ -37,6 +38,8 @@ type Root struct {
lastCheck time.Time
*MetaDir
uid, gid uint32
}
// ensure that *Root implements these interfaces
@@ -56,6 +59,11 @@ func NewRoot(ctx context.Context, repo restic.Repository, cfg Config) (*Root, er
blobSizeCache: NewBlobSizeCache(ctx, repo.Index()),
}
if !cfg.OwnerIsRoot {
root.uid = uint32(os.Getuid())
root.gid = uint32(os.Getgid())
}
entries := map[string]fs.Node{
"snapshots": NewSnapshotsDir(root, fs.GenerateDynamicInode(root.inode, "snapshots"), "", ""),
"tags": NewTagsDir(root, fs.GenerateDynamicInode(root.inode, "tags")),