From ee3cff8ab9ff6e42207187a2996832e071f0a44f Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Wed, 8 Mar 2023 16:55:41 -0800 Subject: [PATCH] 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 --- runsc/boot/mount_hints.go | 2 ++ runsc/boot/vfs.go | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runsc/boot/mount_hints.go b/runsc/boot/mount_hints.go index 60833afae..794356d61 100644 --- a/runsc/boot/mount_hints.go +++ b/runsc/boot/mount_hints.go @@ -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 } diff --git a/runsc/boot/vfs.go b/runsc/boot/vfs.go index be63de370..88e0cd946 100644 --- a/runsc/boot/vfs.go +++ b/runsc/boot/vfs.go @@ -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 }