Commit 039d39cf authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher Committed by Han-Wen Nienhuys

fuse: fix DirectMount mixups

Two variable were defined but never used in what looks like
a copy-paste error or something.

Fix that, which also makes the tests pass.

Change-Id: Iebf48583874977c518d888d9a80bc1f02e2a7f86
parent 05c0aea6
...@@ -256,8 +256,11 @@ type MountOptions struct { ...@@ -256,8 +256,11 @@ type MountOptions struct {
// DirectMountStrict wins. // DirectMountStrict wins.
DirectMountStrict bool DirectMountStrict bool
// Options passed to syscall.Mount, the default value used by fusermount // DirectMountFlags are the mountflags passed to syscall.Mount. If zero, the
// is syscall.MS_NOSUID|syscall.MS_NODEV // default value used by fusermount are used: syscall.MS_NOSUID|syscall.MS_NODEV.
//
// If you actually *want* zero flags, pass syscall.MS_MGC_VAL, which is ignored
// by the kernel. See `man 2 mount` for details about MS_MGC_VAL.
DirectMountFlags uintptr DirectMountFlags uintptr
// EnableAcls enables kernel ACL support. // EnableAcls enables kernel ACL support.
......
...@@ -41,8 +41,10 @@ func mountDirect(mountPoint string, opts *MountOptions, ready chan<- error) (fd ...@@ -41,8 +41,10 @@ func mountDirect(mountPoint string, opts *MountOptions, ready chan<- error) (fd
source = opts.Name source = opts.Name
} }
var flags uintptr var flags uintptr = syscall.MS_NOSUID | syscall.MS_NODEV
flags |= syscall.MS_NOSUID | syscall.MS_NODEV if opts.DirectMountFlags != 0 {
flags = opts.DirectMountFlags
}
// some values we need to pass to mount, but override possible since opts.Options comes after // some values we need to pass to mount, but override possible since opts.Options comes after
var r = []string{ var r = []string{
...@@ -59,9 +61,9 @@ func mountDirect(mountPoint string, opts *MountOptions, ready chan<- error) (fd ...@@ -59,9 +61,9 @@ func mountDirect(mountPoint string, opts *MountOptions, ready chan<- error) (fd
if opts.Debug { if opts.Debug {
log.Printf("mountDirect: calling syscall.Mount(%q, %q, %q, %#x, %q)", log.Printf("mountDirect: calling syscall.Mount(%q, %q, %q, %#x, %q)",
opts.FsName, mountPoint, "fuse."+opts.Name, opts.DirectMountFlags, strings.Join(r, ",")) source, mountPoint, "fuse."+opts.Name, flags, strings.Join(r, ","))
} }
err = syscall.Mount(opts.FsName, mountPoint, "fuse."+opts.Name, opts.DirectMountFlags, strings.Join(r, ",")) err = syscall.Mount(source, mountPoint, "fuse."+opts.Name, flags, strings.Join(r, ","))
if err != nil { if err != nil {
syscall.Close(fd) syscall.Close(fd)
return return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment