Avoid setting S_ISGID on files in volumes.

Directories in volumes are set S_ISGID to ensure files created inside
them inherit group ownership.  Currently, files are also set S_ISGID
however this is not relevant to the original intent, and indicates
'mandatory file locking' (stat(2)).

With this commit, only directories are set S_ISGID.
This commit is contained in:
Seth Jennings 2016-11-07 14:18:32 -06:00
parent dbc4121e16
commit 67f3134232

View File

@ -71,7 +71,11 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error {
mask = roMask
}
err = chmodRunner.Chmod(path, info.Mode()|mask|os.ModeSetgid)
if info.IsDir() {
mask |= os.ModeSetgid
}
err = chmodRunner.Chmod(path, info.Mode()|mask)
if err != nil {
glog.Errorf("Chmod failed on %v: %v", path, err)
}