From 2112d99140e6fc4cb1c6dab4f4fd9f458d7081bc Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 27 Feb 2022 01:13:32 -0800 Subject: [PATCH 1/3] mount2: add back readonly mode --- weed/command/mount2_std.go | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/weed/command/mount2_std.go b/weed/command/mount2_std.go index 9f87b35b5..fdb7a090c 100644 --- a/weed/command/mount2_std.go +++ b/weed/command/mount2_std.go @@ -158,10 +158,33 @@ func RunMount2(option *Mount2Options, umask os.FileMode) bool { Debug: false, // *option.debug, EnableLocks: false, ExplicitDataCacheControl: false, - // SyncRead: false, // set to false to enable the FUSE_CAP_ASYNC_READ capability - DirectMount: true, - DirectMountFlags: 0, - // EnableAcl: false, + DirectMount: true, + DirectMountFlags: 0, + //SyncRead: false, // set to false to enable the FUSE_CAP_ASYNC_READ capability + //EnableAcl: true, + } + if *option.nonempty { + fuseMountOptions.Options = append(fuseMountOptions.Options, "nonempty") + } + if *option.readOnly { + if runtime.GOOS == "darwin" { + fuseMountOptions.Options = append(fuseMountOptions.Options, "rdonly") + } else { + fuseMountOptions.Options = append(fuseMountOptions.Options, "ro") + } + } + if runtime.GOOS == "darwin" { + // https://github-wiki-see.page/m/macfuse/macfuse/wiki/Mount-Options + ioSizeMB := 1 + for ioSizeMB*2 <= *option.chunkSizeLimitMB && ioSizeMB*2 <= 32 { + ioSizeMB *= 2 + } + fuseMountOptions.Options = append(fuseMountOptions.Options, "daemon_timeout=600") + fuseMountOptions.Options = append(fuseMountOptions.Options, "noapplexattr") + fuseMountOptions.Options = append(fuseMountOptions.Options, "novncache") + fuseMountOptions.Options = append(fuseMountOptions.Options, "slow_statfs") + fuseMountOptions.Options = append(fuseMountOptions.Options, "volname="+*option.filer) + fuseMountOptions.Options = append(fuseMountOptions.Options, fmt.Sprintf("iosize=%d", ioSizeMB*1024*1024)) } // find mount point From 6e1ab979888f3f2f2bcc39e151c9876505aa8aba Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 27 Feb 2022 02:02:30 -0800 Subject: [PATCH 2/3] use debug option to see operations --- weed/command/mount2_std.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weed/command/mount2_std.go b/weed/command/mount2_std.go index fdb7a090c..61555d8f2 100644 --- a/weed/command/mount2_std.go +++ b/weed/command/mount2_std.go @@ -155,7 +155,7 @@ func RunMount2(option *Mount2Options, umask os.FileMode) bool { Name: "seaweedfs", SingleThreaded: false, DisableXAttrs: false, - Debug: false, // *option.debug, + Debug: *option.debug, EnableLocks: false, ExplicitDataCacheControl: false, DirectMount: true, @@ -181,7 +181,7 @@ func RunMount2(option *Mount2Options, umask os.FileMode) bool { } fuseMountOptions.Options = append(fuseMountOptions.Options, "daemon_timeout=600") fuseMountOptions.Options = append(fuseMountOptions.Options, "noapplexattr") - fuseMountOptions.Options = append(fuseMountOptions.Options, "novncache") + // fuseMountOptions.Options = append(fuseMountOptions.Options, "novncache") // need to test effectiveness fuseMountOptions.Options = append(fuseMountOptions.Options, "slow_statfs") fuseMountOptions.Options = append(fuseMountOptions.Options, "volname="+*option.filer) fuseMountOptions.Options = append(fuseMountOptions.Options, fmt.Sprintf("iosize=%d", ioSizeMB*1024*1024)) From 22362f64958f8587992f98eb2f7fac95fd204516 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 27 Feb 2022 02:44:10 -0800 Subject: [PATCH 3/3] avoid too many logs in tmp folder --- docker/entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 856943a0b..6818d9581 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -24,7 +24,7 @@ case "$1" in 'master') ARGS="-mdir=/data -volumePreallocate -volumeSizeLimitMB=1024" shift - exec /usr/bin/weed master $ARGS $@ + exec /usr/bin/weed -logtostderr=true master $ARGS $@ ;; 'volume') @@ -33,7 +33,7 @@ case "$1" in ARGS="-dir=/data" fi shift - exec /usr/bin/weed volume $ARGS $@ + exec /usr/bin/weed -logtostderr=true volume $ARGS $@ ;; 'server') @@ -42,19 +42,19 @@ case "$1" in ARGS="-dir=/data -master.volumePreallocate -master.volumeSizeLimitMB=1024" fi shift - exec /usr/bin/weed server $ARGS $@ + exec /usr/bin/weed -logtostderr=true server $ARGS $@ ;; 'filer') ARGS="" shift - exec /usr/bin/weed filer $ARGS $@ + exec /usr/bin/weed -logtostderr=true filer $ARGS $@ ;; 's3') ARGS="-domainName=$S3_DOMAIN_NAME -key.file=$S3_KEY_FILE -cert.file=$S3_CERT_FILE" shift - exec /usr/bin/weed s3 $ARGS $@ + exec /usr/bin/weed -logtostderr=true s3 $ARGS $@ ;; *)