Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

namespace: make MountFlags=shared work again #117

Merged
merged 1 commit into from
Apr 26, 2019
Merged

namespace: make MountFlags=shared work again #117

merged 1 commit into from
Apr 26, 2019

Conversation

dm0-
Copy link

@dm0- dm0- commented Apr 25, 2019

Backport 37ed15d to fix coreos/bugs#2579.

Since commit 0722b35, the root mountpoint is
unconditionnally turned to slave which breaks units that are using explicitly
MountFlags=shared (and no other options that would implicitly require a slave
root mountpoint).

Here is a test case:

  $ systemctl cat test-shared-mount-flag.service
  # /etc/systemd/system/test-shared-mount-flag.service
  [Service]
  Type=simple
  ExecStartPre=/usr/bin/mkdir -p /mnt/tmp
  ExecStart=/bin/sh -c "/usr/bin/mount -t tmpfs -o size=10M none /mnt/tmp && sleep infinity"
  ExecStop=-/bin/sh -c "/usr/bin/umount /mnt/tmp"
  MountFlags=shared

  $ systemctl start test-shared-mount-flag.service
  $ findmnt /mnt/tmp
  $

Mount on /mnt/tmp is not visible from the host although MountFlags=shared was
used.

This patch fixes that and turns the root mountpoint to slave when it's really
required.

(cherry picked from commit 37ed15d)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants