diff options
| author | limd <limd@sugon.com> | 2020-09-24 18:07:16 +0800 |
|---|---|---|
| committer | limd <limd@sugon.com> | 2020-09-24 18:07:16 +0800 |
| commit | cbca14edc562889f866ec5b1228f44950c48dff5 (patch) | |
| tree | 0adc1f64b6a150072b6c07e0314820074e9815d6 /weed/command/mount_std.go | |
| parent | 59e91e9c7eacbafa3bcdc835eb7b78395210a082 (diff) | |
| download | seaweedfs-cbca14edc562889f866ec5b1228f44950c48dff5.tar.xz seaweedfs-cbca14edc562889f866ec5b1228f44950c48dff5.zip | |
mount: fix k8s pvc and os mount directory permission bug
Diffstat (limited to 'weed/command/mount_std.go')
| -rw-r--r-- | weed/command/mount_std.go | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go index cbac35351..7c0f56d3a 100644 --- a/weed/command/mount_std.go +++ b/weed/command/mount_std.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/chrislusf/seaweedfs/weed/filesys/meta_cache" "os" - "os/user" "path" "runtime" "strconv" @@ -87,35 +86,11 @@ func RunMount(option *MountOptions, umask os.FileMode) bool { fuse.Unmount(dir) - uid, gid := uint32(0), uint32(0) - // detect mount folder mode if *option.dirAutoCreate { os.MkdirAll(dir, os.FileMode(0777)&^umask) - os.Chmod(dir, os.FileMode(0777)&^umask) } - mountMode := os.ModeDir | 0777 fileInfo, err := os.Stat(dir) - if err == nil { - mountMode = os.ModeDir | fileInfo.Mode() - uid, gid = util.GetFileUidGid(fileInfo) - fmt.Printf("mount point owner uid=%d gid=%d mode=%s\n", uid, gid, fileInfo.Mode()) - } else { - fmt.Printf("can not stat %s\n", dir) - return false - } - - if uid == 0 { - if u, err := user.Current(); err == nil { - if parsedId, pe := strconv.ParseUint(u.Uid, 10, 32); pe == nil { - uid = uint32(parsedId) - } - if parsedId, pe := strconv.ParseUint(u.Gid, 10, 32); pe == nil { - gid = uint32(parsedId) - } - fmt.Printf("current uid=%d gid=%d\n", uid, gid) - } - } // mapping uid, gid uidGidMapper, err := meta_cache.NewUidGidMapper(*option.uidMap, *option.gidMap) @@ -175,9 +150,6 @@ func RunMount(option *MountOptions, umask os.FileMode) bool { CacheSizeMB: *option.cacheSizeMB, DataCenter: *option.dataCenter, EntryCacheTtl: 3 * time.Second, - MountUid: uid, - MountGid: gid, - MountMode: mountMode, MountCtime: fileInfo.ModTime(), MountMtime: time.Now(), Umask: umask, |
