forked from TrueCloudLab/rclone
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.
This commit is contained in:
parent
ab78eb13e4
commit
473e3c3eb8
3 changed files with 11 additions and 2 deletions
|
@ -88,6 +88,9 @@ func mountOptions(device string, mountpoint string) (options []string) {
|
||||||
if mountlib.WritebackCache {
|
if mountlib.WritebackCache {
|
||||||
// FIXME? options = append(options, "-o", 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 {
|
for _, option := range mountlib.ExtraOptions {
|
||||||
options = append(options, "-o", option)
|
options = append(options, "-o", option)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package mount
|
package mount
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
@ -63,6 +64,9 @@ func mountOptions(device string) (options []fuse.MountOption) {
|
||||||
if mountlib.WritebackCache {
|
if mountlib.WritebackCache {
|
||||||
options = append(options, fuse.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 {
|
if len(mountlib.ExtraOptions) > 0 {
|
||||||
fs.Errorf(nil, "-o/--option not supported with this FUSE backend")
|
fs.Errorf(nil, "-o/--option not supported with this FUSE backend")
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,9 @@ var (
|
||||||
ExtraFlags []string
|
ExtraFlags []string
|
||||||
AttrTimeout = 1 * time.Second // how long the kernel caches attribute for
|
AttrTimeout = 1 * time.Second // how long the kernel caches attribute for
|
||||||
VolumeName string
|
VolumeName string
|
||||||
NoAppleDouble = true // use noappledouble by default
|
NoAppleDouble = true // use noappledouble by default
|
||||||
NoAppleXattr = false // do not use noapplexattr by default
|
NoAppleXattr = false // do not use noapplexattr by default
|
||||||
|
DaemonTimeout time.Duration // OSXFUSE only
|
||||||
)
|
)
|
||||||
|
|
||||||
// Check is folder is empty
|
// 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.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.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.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" {
|
if runtime.GOOS == "darwin" {
|
||||||
flags.BoolVarP(flagSet, &NoAppleDouble, "noappledouble", "", NoAppleDouble, "Sets the OSXFUSE option noappledouble.")
|
flags.BoolVarP(flagSet, &NoAppleDouble, "noappledouble", "", NoAppleDouble, "Sets the OSXFUSE option noappledouble.")
|
||||||
|
|
Loading…
Reference in a new issue