diff options
Diffstat (limited to 'weed/command')
| -rw-r--r-- | weed/command/mount_darwin.go | 4 | ||||
| -rw-r--r-- | weed/command/mount_freebsd.go | 4 | ||||
| -rw-r--r-- | weed/command/mount_linux.go | 14 | ||||
| -rw-r--r-- | weed/command/mount_std.go | 16 |
4 files changed, 32 insertions, 6 deletions
diff --git a/weed/command/mount_darwin.go b/weed/command/mount_darwin.go index 632691e47..f0a5581e7 100644 --- a/weed/command/mount_darwin.go +++ b/weed/command/mount_darwin.go @@ -7,3 +7,7 @@ import ( func osSpecificMountOptions() []fuse.MountOption { return []fuse.MountOption{} } + +func checkMountPointAvailable(dir string) bool { + return true +} diff --git a/weed/command/mount_freebsd.go b/weed/command/mount_freebsd.go index 632691e47..f0a5581e7 100644 --- a/weed/command/mount_freebsd.go +++ b/weed/command/mount_freebsd.go @@ -7,3 +7,7 @@ import ( func osSpecificMountOptions() []fuse.MountOption { return []fuse.MountOption{} } + +func checkMountPointAvailable(dir string) bool { + return true +} diff --git a/weed/command/mount_linux.go b/weed/command/mount_linux.go index 7d94e5142..591951d4f 100644 --- a/weed/command/mount_linux.go +++ b/weed/command/mount_linux.go @@ -1,6 +1,7 @@ package command import ( + "github.com/chrislusf/seaweedfs/weed/util" "github.com/seaweedfs/fuse" ) @@ -9,3 +10,16 @@ func osSpecificMountOptions() []fuse.MountOption { fuse.AllowNonEmptyMount(), } } + +func checkMountPointAvailable(dir string) bool { + mountPoint := dir + if mountPoint != "/" && strings.HasSuffix(mountPoint, "/") { + mountPoint = mountPoint[0 : len(mountPoint)-1] + } + + if mounted, err := util.Mounted(mountPoint); err != nil || mounted { + return false + } + + return true +} diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go index 6ca9bfdca..8cc0586ce 100644 --- a/weed/command/mount_std.go +++ b/weed/command/mount_std.go @@ -12,15 +12,14 @@ import ( "strings" "time" - "github.com/chrislusf/seaweedfs/weed/security" - "github.com/jacobsa/daemonize" - "github.com/spf13/viper" - "github.com/chrislusf/seaweedfs/weed/filesys" "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/util" + "github.com/jacobsa/daemonize" "github.com/seaweedfs/fuse" "github.com/seaweedfs/fuse/fs" + "github.com/spf13/viper" ) func runMount(cmd *Command, args []string) bool { @@ -88,12 +87,17 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCente } } + if isValid := checkMountPointAvailable(dir); !isValid { + glog.Fatalf("Expected mount to still be active, target mount point: %s, please check!", dir) + return false + } + mountName := path.Base(dir) options := []fuse.MountOption{ fuse.VolumeName(mountName), - fuse.FSName("SeaweedFS"), - fuse.Subtype("SeaweedFS"), + fuse.FSName(filer + ":" + filerMountRootPath), + fuse.Subtype("seaweedfs"), fuse.NoAppleDouble(), fuse.NoAppleXattr(), fuse.NoBrowse(), |
