summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-11-08 06:14:46 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2018-11-28 15:48:25 -0500
commita5be3ffa4d1502072fd18ee280cc062b71fbe574 (patch)
tree2e5fd81b3cebad3342003a3d73887c44dff36fbd /libpod
parent4bb2fdeebcdf4165bb8005d420b72722a4427906 (diff)
downloadpodman-a5be3ffa4d1502072fd18ee280cc062b71fbe574.tar.gz
podman-a5be3ffa4d1502072fd18ee280cc062b71fbe574.tar.bz2
podman-a5be3ffa4d1502072fd18ee280cc062b71fbe574.zip
/dev/shm should be mounted even in rootless mode.
Currently we are mounting /dev/shm from disk, it should be from a tmpfs. User Namespace supports tmpfs mounts for nonroot users, so this section of code should work fine in bother root and rootless mode. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go26
1 files changed, 10 insertions, 16 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index b616e0a07..24ddb6655 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -821,28 +821,22 @@ func (c *Container) mountStorage() (string, error) {
return c.state.Mountpoint, nil
}
- if !rootless.IsRootless() {
- // TODO: generalize this mount code so it will mount every mount in ctr.config.Mounts
- mounted, err := mount.Mounted(c.config.ShmDir)
- if err != nil {
- return "", errors.Wrapf(err, "unable to determine if %q is mounted", c.config.ShmDir)
- }
+ mounted, err := mount.Mounted(c.config.ShmDir)
+ if err != nil {
+ return "", errors.Wrapf(err, "unable to determine if %q is mounted", c.config.ShmDir)
+ }
+ if !mounted {
+ shmOptions := fmt.Sprintf("mode=1777,size=%d", c.config.ShmSize)
+ if err := c.mountSHM(shmOptions); err != nil {
+ return "", err
+ }
if err := os.Chown(c.config.ShmDir, c.RootUID(), c.RootGID()); err != nil {
return "", errors.Wrapf(err, "failed to chown %s", c.config.ShmDir)
}
-
- if !mounted {
- shmOptions := fmt.Sprintf("mode=1777,size=%d", c.config.ShmSize)
- if err := c.mountSHM(shmOptions); err != nil {
- return "", err
- }
- if err := os.Chown(c.config.ShmDir, c.RootUID(), c.RootGID()); err != nil {
- return "", errors.Wrapf(err, "failed to chown %s", c.config.ShmDir)
- }
- }
}
+ // TODO: generalize this mount code so it will mount every mount in ctr.config.Mounts
mountPoint := c.config.Rootfs
if mountPoint == "" {
mountPoint, err = c.mount()