From 8ec872e330985a2de87c3b15d6c49ab9e3281573 Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Fri, 8 Oct 2021 20:54:41 +0000 Subject: [PATCH] fusefrontend: honor ForceOwner for LOOKUP and CREATE operations --- internal/fusefrontend/node.go | 4 ++++ internal/fusefrontend/node_open_create.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go index 99d337f..182cda5 100644 --- a/internal/fusefrontend/node.go +++ b/internal/fusefrontend/node.go @@ -41,6 +41,10 @@ func (n *Node) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (ch n.translateSize(dirfd, cName, &out.Attr) rn := n.rootNode() + if rn.args.ForceOwner != nil { + out.Owner = *rn.args.ForceOwner + } + if rn.args.SharedStorage { // If we already have a child node that matches what we found on disk* // (as reflected in `ch`), return it here. diff --git a/internal/fusefrontend/node_open_create.go b/internal/fusefrontend/node_open_create.go index eb45fb4..9598559 100644 --- a/internal/fusefrontend/node_open_create.go +++ b/internal/fusefrontend/node_open_create.go @@ -103,6 +103,12 @@ func (n *Node) Create(ctx context.Context, name string, flags uint32, mode uint3 if errno != 0 { return } + inode = n.newChild(ctx, st, out) + + if rn.args.ForceOwner != nil { + out.Owner = *rn.args.ForceOwner + } + return inode, fh, fuseFlags, errno }