From 67f31342329097d3b003285f12b9b3663f4ede2b Mon Sep 17 00:00:00 2001 From: Seth Jennings Date: Mon, 7 Nov 2016 14:18:32 -0600 Subject: [PATCH] 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. --- pkg/volume/volume_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/volume/volume_linux.go b/pkg/volume/volume_linux.go index cd8b6b2b82e..1391e62256b 100644 --- a/pkg/volume/volume_linux.go +++ b/pkg/volume/volume_linux.go @@ -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) }