From 473e3c3eb8dc297db210d89a24bff274ce319c72 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 18 Jul 2018 16:21:35 +0100 Subject: [PATCH] mount/cmount: implement --daemon-timeout flag for OSXFUSE By default the timeout is 60s which isn't long enough for long transactions. The symptoms are rclone just quitting for no reason. Supplying the --daemon-timeout flag fixes this causing the kernel to wait longer for rclone. --- cmd/cmount/mount.go | 3 +++ cmd/mount/mount.go | 4 ++++ cmd/mountlib/mount.go | 6 ++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go index b40c7c6c6..8bfd13c28 100644 --- a/cmd/cmount/mount.go +++ b/cmd/cmount/mount.go @@ -88,6 +88,9 @@ func mountOptions(device string, mountpoint string) (options []string) { if mountlib.WritebackCache { // FIXME? options = append(options, "-o", WritebackCache()) } + if mountlib.DaemonTimeout != 0 { + options = append(options, "-o", fmt.Sprintf("daemon_timeout=%d", int(mountlib.DaemonTimeout.Seconds()))) + } for _, option := range mountlib.ExtraOptions { options = append(options, "-o", option) } diff --git a/cmd/mount/mount.go b/cmd/mount/mount.go index e25799b8f..bbde3076e 100644 --- a/cmd/mount/mount.go +++ b/cmd/mount/mount.go @@ -5,6 +5,7 @@ package mount import ( + "fmt" "os" "os/signal" "syscall" @@ -63,6 +64,9 @@ func mountOptions(device string) (options []fuse.MountOption) { if mountlib.WritebackCache { options = append(options, fuse.WritebackCache()) } + if mountlib.DaemonTimeout != 0 { + options = append(options, fuse.DaemonTimeout(fmt.Sprint(int(mountlib.DaemonTimeout.Seconds())))) + } if len(mountlib.ExtraOptions) > 0 { fs.Errorf(nil, "-o/--option not supported with this FUSE backend") } diff --git a/cmd/mountlib/mount.go b/cmd/mountlib/mount.go index 00fa0c911..5cfd1ec5f 100644 --- a/cmd/mountlib/mount.go +++ b/cmd/mountlib/mount.go @@ -31,8 +31,9 @@ var ( ExtraFlags []string AttrTimeout = 1 * time.Second // how long the kernel caches attribute for VolumeName string - NoAppleDouble = true // use noappledouble by default - NoAppleXattr = false // do not use noapplexattr by default + NoAppleDouble = true // use noappledouble by default + NoAppleXattr = false // do not use noapplexattr by default + DaemonTimeout time.Duration // OSXFUSE only ) // Check is folder is empty @@ -274,6 +275,7 @@ be copied to the vfs cache before opening with --vfs-cache-mode full. flags.StringArrayVarP(flagSet, &ExtraFlags, "fuse-flag", "", []string{}, "Flags or arguments to be passed direct to libfuse/WinFsp. Repeat if required.") flags.BoolVarP(flagSet, &Daemon, "daemon", "", Daemon, "Run mount as a daemon (background mode).") flags.StringVarP(flagSet, &VolumeName, "volname", "", VolumeName, "Set the volume name (not supported by all OSes).") + flags.DurationVarP(flagSet, &DaemonTimeout, "daemon-timeout", "", DaemonTimeout, "Time limit for rclone to respond to kernel (not supported by all OSes).") if runtime.GOOS == "darwin" { flags.BoolVarP(flagSet, &NoAppleDouble, "noappledouble", "", NoAppleDouble, "Sets the OSXFUSE option noappledouble.")