diff options
author | Jakob Unterwurzacher | 2021-09-10 17:17:16 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-09-10 17:17:16 +0200 |
commit | c9b825c58a9f996379108926754513bca03bb306 (patch) | |
tree | 51e2831bae6904945babd682fab16382c14b989d /internal/fusefrontend | |
parent | ee561035707527dee48cecfc9466ab4921666b43 (diff) |
inomap: deterministically set root device
We used to have "first Translate() wins". This is not deterministic,
as the LOOKUP for the root directory does not seem to reach us, so
the first user LOOKUP would win, which may be on a mountpoint.
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r-- | internal/fusefrontend/root_node.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/fusefrontend/root_node.go b/internal/fusefrontend/root_node.go index 7d37520..7221be6 100644 --- a/internal/fusefrontend/root_node.go +++ b/internal/fusefrontend/root_node.go @@ -62,18 +62,28 @@ type RootNode struct { } func NewRootNode(args Args, c *contentenc.ContentEnc, n *nametransform.NameTransform) *RootNode { + var rootDev uint64 + var st syscall.Stat_t + if err := syscall.Stat(args.Cipherdir, &st); err != nil { + tlog.Warn.Printf("Could not stat backing directory %q: %v", args.Cipherdir, err) + } else { + rootDev = uint64(st.Dev) + } + if len(args.Exclude) > 0 { tlog.Warn.Printf("Forward mode does not support -exclude") } + ivLen := nametransform.DirIVLen if args.PlaintextNames { ivLen = 0 } + rn := &RootNode{ args: args, nameTransform: n, contentEnc: c, - inoMap: inomap.New(), + inoMap: inomap.New(rootDev), dirCache: dirCache{ivLen: ivLen}, quirks: syscallcompat.DetectQuirks(args.Cipherdir), } |