From 155de7f67c9bf983850d6a04fd40cc4ba5339383 Mon Sep 17 00:00:00 2001 From: Prince Kumar Date: Wed, 30 Nov 2022 13:16:52 +0530 Subject: [PATCH] Updated the gcsfuse with latest jacobsa/fuse --- go.mod | 2 +- go.sum | 2 ++ vendor/github.com/jacobsa/fuse/conversions.go | 17 +++++++++++++++++ vendor/github.com/jacobsa/fuse/fuseops/ops.go | 2 ++ .../jacobsa/fuse/mounted_file_system.go | 19 ++++++++++++++++++- vendor/modules.txt | 2 +- 6 files changed, 41 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 99eacb6152..44e09c2f4f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( contrib.go.opencensus.io/exporter/ocagent v0.7.0 contrib.go.opencensus.io/exporter/stackdriver v0.13.12 github.com/jacobsa/daemonize v0.0.0-20160101105449-e460293e890f - github.com/jacobsa/fuse v0.0.0-20220906065402-c62d7682a662 + github.com/jacobsa/fuse v0.0.0-20221016084658-a4cd154343d8 github.com/jacobsa/gcloud v0.0.0-20220926120811-1a153c059feb github.com/jacobsa/oglematchers v0.0.0-20150720000706-141901ea67cd github.com/jacobsa/oglemock v0.0.0-20150831005832-e94d794d06ff diff --git a/go.sum b/go.sum index bccfa0ef21..28f038b923 100644 --- a/go.sum +++ b/go.sum @@ -232,6 +232,8 @@ github.com/jacobsa/fuse v0.0.0-20220726073400-226fec2ce902 h1:/IQH2E2OKt1gyALxVd github.com/jacobsa/fuse v0.0.0-20220726073400-226fec2ce902/go.mod h1:liOmRdJd8oTwHCQ5M9JemRE3CebdlYcZWLk+ZjQeuq0= github.com/jacobsa/fuse v0.0.0-20220906065402-c62d7682a662 h1:VGS7vFZIC+TgfFYA0PJRCmazMNp8MT5wNhnjv5AdcYc= github.com/jacobsa/fuse v0.0.0-20220906065402-c62d7682a662/go.mod h1:liOmRdJd8oTwHCQ5M9JemRE3CebdlYcZWLk+ZjQeuq0= +github.com/jacobsa/fuse v0.0.0-20221016084658-a4cd154343d8 h1:uv+7DeBJF6+a54ZUihuXR+uTzhv2JslllK5ByILxxbg= +github.com/jacobsa/fuse v0.0.0-20221016084658-a4cd154343d8/go.mod h1:liOmRdJd8oTwHCQ5M9JemRE3CebdlYcZWLk+ZjQeuq0= github.com/jacobsa/gcloud v0.0.0-20220802142722-cef0860fbd4c h1:goyPEosKe0lTMZZyqXtiB9VdvzioVCL+7dJn2mdR0W4= github.com/jacobsa/gcloud v0.0.0-20220802142722-cef0860fbd4c/go.mod h1:kYk8Udk1FpP2Nn/ABkB6yT7jHkDhewIq8eGRZMLRGDU= github.com/jacobsa/gcloud v0.0.0-20220902140020-1c120ff05604 h1:CS7nR1glaHgdAdx+V5a31C/1wODBBgbXSbVwFGeOhms= diff --git a/vendor/github.com/jacobsa/fuse/conversions.go b/vendor/github.com/jacobsa/fuse/conversions.go index fbcc7bb77a..86aa7e99b9 100644 --- a/vendor/github.com/jacobsa/fuse/conversions.go +++ b/vendor/github.com/jacobsa/fuse/conversions.go @@ -76,6 +76,14 @@ func convertInMessage( o = to valid := fusekernel.SetattrValid(in.Valid) + if valid&fusekernel.SetattrUid != 0 { + to.Uid = &in.Uid + } + + if valid&fusekernel.SetattrGid != 0 { + to.Gid = &in.Gid + } + if valid&fusekernel.SetattrSize != 0 { to.Size = &in.Size } @@ -911,6 +919,12 @@ func convertAttributes( if in.Mode&os.ModeSetuid != 0 { out.Mode |= syscall.S_ISUID } + if in.Mode&os.ModeSetgid != 0 { + out.Mode |= syscall.S_ISGID + } + if in.Mode&os.ModeSticky != 0 { + out.Mode |= syscall.S_ISVTX + } } // Convert an absolute cache expiration time to a relative time from now for @@ -967,6 +981,9 @@ func convertFileMode(unixMode uint32) os.FileMode { if unixMode&syscall.S_ISGID != 0 { mode |= os.ModeSetgid } + if unixMode&syscall.S_ISVTX != 0 { + mode |= os.ModeSticky + } return mode } diff --git a/vendor/github.com/jacobsa/fuse/fuseops/ops.go b/vendor/github.com/jacobsa/fuse/fuseops/ops.go index db096f6c07..a150af5121 100644 --- a/vendor/github.com/jacobsa/fuse/fuseops/ops.go +++ b/vendor/github.com/jacobsa/fuse/fuseops/ops.go @@ -161,6 +161,8 @@ type SetInodeAttributesOp struct { Handle *HandleID // The attributes to modify, or nil for attributes that don't need a change. + Uid *uint32 + Gid *uint32 Size *uint64 Mode *os.FileMode Atime *time.Time diff --git a/vendor/github.com/jacobsa/fuse/mounted_file_system.go b/vendor/github.com/jacobsa/fuse/mounted_file_system.go index bb9bb35037..fe272cfc87 100644 --- a/vendor/github.com/jacobsa/fuse/mounted_file_system.go +++ b/vendor/github.com/jacobsa/fuse/mounted_file_system.go @@ -14,7 +14,10 @@ package fuse -import "context" +import ( + "context" + "fmt" +) // MountedFileSystem represents the status of a mount operation, with a method // that waits for unmounting. @@ -47,3 +50,17 @@ func (mfs *MountedFileSystem) Join(ctx context.Context) error { return ctx.Err() } } + +// GetFuseContext implements the equiv. of FUSE-C fuse_get_context() and thus +// returns the UID / GID / PID associated with all FUSE requests send by the kernel. +// ctx parameter must be one of the context from the fuseops handlers (e.g.: CreateFile) +func (mfs *MountedFileSystem) GetFuseContext(ctx context.Context) (uid, gid, pid uint32, err error) { + foo := ctx.Value(contextKey) + state, ok := foo.(opState) + if !ok { + return 0, 0, 0, fmt.Errorf("GetFuseContext called with invalid context: %#v", ctx) + } + inMsg := state.inMsg + header := inMsg.Header() + return header.Uid, header.Gid, header.Pid, nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index b4b08134ae..2182370008 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -155,7 +155,7 @@ github.com/grpc-ecosystem/grpc-gateway/utilities # github.com/jacobsa/daemonize v0.0.0-20160101105449-e460293e890f ## explicit github.com/jacobsa/daemonize -# github.com/jacobsa/fuse v0.0.0-20220906065402-c62d7682a662 +# github.com/jacobsa/fuse v0.0.0-20221016084658-a4cd154343d8 ## explicit; go 1.18 github.com/jacobsa/fuse github.com/jacobsa/fuse/fsutil