summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorgabi beyer <gabrielle.n.beyer@intel.com>2019-08-23 17:52:45 +0000
committerMarco Vedovati <mvedovati@suse.com>2019-09-24 11:01:28 +0200
commit0115be19f5a7e1e29b78b13b769c6b33149e1437 (patch)
tree7c83bb06b6ede8d5ba7d42deaca618242c82ed85 /pkg
parentf50ba201c4d54aa51dc53af89d53caf552a4b5bb (diff)
downloadpodman-0115be19f5a7e1e29b78b13b769c6b33149e1437.tar.gz
podman-0115be19f5a7e1e29b78b13b769c6b33149e1437.tar.bz2
podman-0115be19f5a7e1e29b78b13b769c6b33149e1437.zip
Make netns bind mount shared
To 'avoid unknown FS magic on "/run/user/1000/netns/...": 1021994' make the network namespace bind-mount recursively shared, so the mount is back-propogated to the host. Signed-off-by: gabi beyer <gabrielle.n.beyer@intel.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/netns/netns_linux.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/netns/netns_linux.go b/pkg/netns/netns_linux.go
index 18d638809..a62296549 100644
--- a/pkg/netns/netns_linux.go
+++ b/pkg/netns/netns_linux.go
@@ -152,8 +152,9 @@ func NewNS() (ns.NetNS, error) {
// bind mount the netns from the current thread (from /proc) onto the
// mount point. This causes the namespace to persist, even when there
- // are no threads in the ns.
- err = unix.Mount(getCurrentThreadNetNSPath(), nsPath, "none", unix.MS_BIND, "")
+ // are no threads in the ns. Make this a shared mount; it needs to be
+ // back-propogated to the host
+ err = unix.Mount(getCurrentThreadNetNSPath(), nsPath, "none", unix.MS_BIND|unix.MS_SHARED|unix.MS_REC, "")
if err != nil {
err = fmt.Errorf("failed to bind mount ns at %s: %v", nsPath, err)
}