aboutsummaryrefslogtreecommitdiff
path: root/weed/command/mount_std.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-21 19:14:25 -0700
committerChris Lu <chris.lu@gmail.com>2020-03-21 19:14:25 -0700
commit7c111f7b75ba2b0a95766897503997d65d05b42c (patch)
tree0fe77e16a6ba8bf136acaa5aeb4fb7e5eb30f3aa /weed/command/mount_std.go
parent3b3e063f25ee3ff58f3beab4d4197fb2d2d19eec (diff)
downloadseaweedfs-7c111f7b75ba2b0a95766897503997d65d05b42c.tar.xz
seaweedfs-7c111f7b75ba2b0a95766897503997d65d05b42c.zip
FUSE mount: make "nonempty" optional
https://github.com/chrislusf/seaweedfs/issues/1094
Diffstat (limited to 'weed/command/mount_std.go')
-rw-r--r--weed/command/mount_std.go41
1 files changed, 17 insertions, 24 deletions
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go
index 9177091a5..22ddd1f07 100644
--- a/weed/command/mount_std.go
+++ b/weed/command/mount_std.go
@@ -35,24 +35,15 @@ func runMount(cmd *Command, args []string) bool {
return false
}
- return RunMount(
- *mountOptions.filer,
- *mountOptions.filerMountRootPath,
- *mountOptions.dir,
- *mountOptions.collection,
- *mountOptions.replication,
- *mountOptions.dataCenter,
- *mountOptions.chunkSizeLimitMB,
- *mountOptions.allowOthers,
- *mountOptions.ttlSec,
- *mountOptions.dirListCacheLimit,
- os.FileMode(umask),
- *mountOptions.outsideContainerClusterMode,
- )
+ return RunMount(&mountOptions, os.FileMode(umask))
}
-func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCenter string, chunkSizeLimitMB int,
- allowOthers bool, ttlSec int, dirListCacheLimit int64, umask os.FileMode, outsideContainerClusterMode bool) bool {
+func RunMount(option *MountOptions, umask os.FileMode) bool {
+
+ filer := *option.filer
+ filerMountRootPath := *option.filerMountRootPath
+ dir := *option.dir
+ chunkSizeLimitMB := *mountOptions.chunkSizeLimitMB
util.LoadConfiguration("security", false)
@@ -114,14 +105,16 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCente
fuse.MaxReadahead(1024 * 128),
fuse.AsyncRead(),
fuse.WritebackCache(),
- fuse.AllowNonEmptyMount(),
}
options = append(options, osSpecificMountOptions()...)
- if allowOthers {
+ if *option.allowOthers {
options = append(options, fuse.AllowOther())
}
+ if *option.nonempty {
+ options = append(options, fuse.AllowNonEmptyMount())
+ }
c, err := fuse.Mount(dir, options...)
if err != nil {
@@ -171,12 +164,12 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCente
FilerGrpcAddress: filerGrpcAddress,
GrpcDialOption: grpcDialOption,
FilerMountRootPath: mountRoot,
- Collection: collection,
- Replication: replication,
- TtlSec: int32(ttlSec),
+ Collection: *option.collection,
+ Replication: *option.replication,
+ TtlSec: int32(*option.ttlSec),
ChunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,
- DataCenter: dataCenter,
- DirListCacheLimit: dirListCacheLimit,
+ DataCenter: *option.dataCenter,
+ DirListCacheLimit: *option.dirListCacheLimit,
EntryCacheTtl: 3 * time.Second,
MountUid: uid,
MountGid: gid,
@@ -184,7 +177,7 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCente
MountCtime: fileInfo.ModTime(),
MountMtime: time.Now(),
Umask: umask,
- OutsideContainerClusterMode: outsideContainerClusterMode,
+ OutsideContainerClusterMode: *mountOptions.outsideContainerClusterMode,
Cipher: cipher,
}))
if err != nil {