Do not create unnecessary tmpfs mount when hint.share = container.

If there is only 1 container that is using an annotated tmpfs mount, then we
create a shared master mount but that is never used. In
containerMounter.mountSubmounts(), we mount a new tmpfs mount if
!hint.isSupported().

PiperOrigin-RevId: 515179844
This commit is contained in:
Ayush Ranjan
2023-03-08 17:06:53 -08:00
committed by gVisor bot
parent 9d96e874a3
commit ee3cff8ab9
2 changed files with 3 additions and 3 deletions
+2
View File
@@ -184,6 +184,8 @@ func (m *mountHint) setOptions(val string) error {
}
func (m *mountHint) isSupported() bool {
// TODO(b/142076984): Only support tmpfs for now. Bind mounts require a
// common gofer to mount all shared volumes.
return m.mount.Type == tmpfs.Name && m.share == pod
}
+1 -3
View File
@@ -919,9 +919,7 @@ func (c *containerMounter) mountTmp(ctx context.Context, conf *config.Config, cr
func (c *containerMounter) processHints(conf *config.Config, creds *auth.Credentials) error {
ctx := c.k.SupervisorContext()
for _, hint := range c.hints.mounts {
// TODO(b/142076984): Only support tmpfs for now. Bind mounts require a
// common gofer to mount all shared volumes.
if hint.mount.Type != tmpfs.Name {
if !hint.isSupported() {
continue
}