Skip to content

Commit 4954c87

Browse files
committed
Always set "max_read" kernel option
We use fixed-size byte slice pools (sync.Pool) and cannot handle larger requests. So ask the kernel to not send bigger ones. Fixes #145
1 parent 268e048 commit 4954c87

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mount.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"encoding/json"
5+
"fmt"
56
"log/syslog"
67
"net"
78
"os"
@@ -250,9 +251,14 @@ func initFuseFrontend(masterkey []byte, args *argContainer, confFile *configfile
250251
}
251252
conn := nodefs.NewFileSystemConnector(pathFs.Root(), fuseOpts)
252253
mOpts := fuse.MountOptions{
253-
// Bigger writes mean fewer calls and better throughput.
254-
// Capped to 128KiB on Linux.
254+
// Writes and reads are usually capped at 128kiB on Linux through
255+
// the FUSE_MAX_PAGES_PER_REQ kernel constant in fuse_i.h. Our
256+
// sync.Pool buffer pools are sized acc. to the default. Users may set
257+
// the kernel constant higher, and Synology NAS kernels are known to
258+
// have it >128kiB. We cannot handle more than 128kiB, so we tell
259+
// the kernel to limit the size explicitely.
255260
MaxWrite: fuse.MAX_KERNEL_WRITE,
261+
Options: []string{fmt.Sprintf("max_read=%d", fuse.MAX_KERNEL_WRITE)},
256262
}
257263
if args.allow_other {
258264
tlog.Info.Printf(tlog.ColorYellow + "The option \"-allow_other\" is set. Make sure the file " +

0 commit comments

Comments
 (0)