Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-default-permissions flag based on latest fuse library. #591

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
url = https://github.com/jtolds/gls
[submodule "vendor/github.com/jacobsa/fuse"]
path = vendor/github.com/jacobsa/fuse
url = https://github.com/kahing/fusego
url = https://github.com/jacobsa/fuse
branch = master
[submodule "vendor/github.com/Azure/go-autorest"]
path = vendor/github.com/Azure/go-autorest
url = https://github.com/Azure/go-autorest/
Expand Down
9 changes: 5 additions & 4 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ func Mount(
}
// Mount the file system.
mountCfg := &fuse.MountConfig{
FSName: bucketName,
Options: flags.MountOptions,
ErrorLogger: GetStdLogger(NewLogger("fuse"), logrus.ErrorLevel),
DisableWritebackCaching: true,
FSName: bucketName,
Options: flags.MountOptions,
ErrorLogger: GetStdLogger(NewLogger("fuse"), logrus.ErrorLevel),
DisableWritebackCaching: true,
DisableDefaultPermissions: flags.DisableDefaultPermissions,
}

if flags.DebugFuse {
Expand Down
11 changes: 6 additions & 5 deletions api/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ type FlagStorage struct {
Backend interface{}

// Tuning
Cheap bool
ExplicitDir bool
StatCacheTTL time.Duration
TypeCacheTTL time.Duration
HTTPTimeout time.Duration
Cheap bool
ExplicitDir bool
StatCacheTTL time.Duration
TypeCacheTTL time.Duration
HTTPTimeout time.Duration
DisableDefaultPermissions bool

// Debugging
DebugFuse bool
Expand Down
2 changes: 1 addition & 1 deletion internal/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ func (parent *Inode) Unlink(name string) (err error) {
}

func (parent *Inode) Create(
name string, metadata fuseops.OpMetadata) (inode *Inode, fh *FileHandle) {
name string, metadata fuseops.OpContext) (inode *Inode, fh *FileHandle) {

parent.logFuse("Create", name)

Expand Down
2 changes: 1 addition & 1 deletion internal/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const READAHEAD_CHUNK = uint32(20 * 1024 * 1024)

// NewFileHandle returns a new file handle for the given `inode` triggered by fuse
// operation with the given `opMetadata`
func NewFileHandle(inode *Inode, opMetadata fuseops.OpMetadata) *FileHandle {
func NewFileHandle(inode *Inode, opMetadata fuseops.OpContext) *FileHandle {
tgid, err := GetTgid(opMetadata.Pid)
if err != nil {
log.Debugf(
Expand Down
17 changes: 11 additions & 6 deletions internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ func NewApp() (app *cli.App) {
Value: 30 * time.Second,
Usage: "Set the timeout on HTTP requests to S3",
},
cli.BoolFlag{
Name: "disable-default-permissions",
Usage: "Disable UNIX default_permissions flag on FUSE mount.",
},

/////////////////////////
// Debugging
Expand Down Expand Up @@ -275,7 +279,7 @@ func NewApp() (app *cli.App) {
flagCategories[f] = "aws"
}

for _, f := range []string{"cheap", "no-implicit-dir", "stat-cache-ttl", "type-cache-ttl", "http-timeout"} {
for _, f := range []string{"cheap", "no-implicit-dir", "stat-cache-ttl", "type-cache-ttl", "http-timeout", "disable-default-permissions"} {
flagCategories[f] = "tuning"
}

Expand Down Expand Up @@ -327,11 +331,12 @@ func PopulateFlags(c *cli.Context) (ret *FlagStorage) {
Gid: uint32(c.Int("gid")),

// Tuning,
Cheap: c.Bool("cheap"),
ExplicitDir: c.Bool("no-implicit-dir"),
StatCacheTTL: c.Duration("stat-cache-ttl"),
TypeCacheTTL: c.Duration("type-cache-ttl"),
HTTPTimeout: c.Duration("http-timeout"),
Cheap: c.Bool("cheap"),
ExplicitDir: c.Bool("no-implicit-dir"),
StatCacheTTL: c.Duration("stat-cache-ttl"),
TypeCacheTTL: c.Duration("type-cache-ttl"),
HTTPTimeout: c.Duration("http-timeout"),
DisableDefaultPermissions: c.Bool("disable-default-permissions"),

// Common Backend Config
Endpoint: c.String("endpoint"),
Expand Down
8 changes: 4 additions & 4 deletions internal/goofys.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ func (fs *Goofys) OpenFile(
in := fs.getInodeOrDie(op.Inode)
fs.mu.RUnlock()

fh, err := in.OpenFile(op.Metadata)
fh, err := in.OpenFile(op.OpContext)
if err != nil {
return
}
Expand Down Expand Up @@ -953,10 +953,10 @@ func (fs *Goofys) FlushFile(
// This check helps us with scenarios like https://github.com/kahing/goofys/issues/273
// Also see goofys_test.go:TestClientForkExec.
if fh.Tgid != nil {
tgid, err := GetTgid(op.Metadata.Pid)
tgid, err := GetTgid(op.OpContext.Pid)
if err != nil {
fh.inode.logFuse("<-- FlushFile",
fmt.Sprintf("Failed to retrieve tgid from op.Metadata.Pid. FlushFileOp:%#v, err:%v",
fmt.Sprintf("Failed to retrieve tgid from op.OpContext.Pid. FlushFileOp:%#v, err:%v",
op, err))
return fuse.EIO
}
Expand Down Expand Up @@ -1013,7 +1013,7 @@ func (fs *Goofys) CreateFile(
parent := fs.getInodeOrDie(op.Parent)
fs.mu.RUnlock()

inode, fh := parent.Create(op.Name, op.Metadata)
inode, fh := parent.Create(op.Name, op.OpContext)

parent.mu.Lock()

Expand Down
2 changes: 1 addition & 1 deletion internal/handles.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ func (inode *Inode) ListXattr() ([]string, error) {
return xattrs, nil
}

func (inode *Inode) OpenFile(metadata fuseops.OpMetadata) (fh *FileHandle, err error) {
func (inode *Inode) OpenFile(metadata fuseops.OpContext) (fh *FileHandle, err error) {
inode.logFuse("OpenFile")

inode.mu.Lock()
Expand Down