Skip to content

Commit 54b9017

Browse files
Merge pull request #2431 from Luap99/rootlessnetns-mount
libnetwork/rootlessnetns: set mount propagation to slave
2 parents 88365b7 + 066beed commit 54b9017

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libnetwork/internal/rootlessnetns/netns_linux.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,14 @@ func (n *Netns) setupMounts() error {
369369

370370
// Ensure we mount private in our mountns to prevent accidentally
371371
// overwriting the host mounts in case the default propagation is shared.
372-
err = unix.Mount("", "/", "", unix.MS_PRIVATE|unix.MS_REC, "")
372+
// However using private propagation is not what we want. New mounts/umounts
373+
// would not be propagated into our namespace. This is a problem because we
374+
// may hold mount points open that were unmounted on the host confusing users
375+
// why the underlying device is still busy as they no longer see the mount:
376+
// https://github.com/containers/podman/issues/25994
377+
err = unix.Mount("", "/", "", unix.MS_SLAVE|unix.MS_REC, "")
373378
if err != nil {
374-
return wrapError("make tree private in new mount namespace", err)
379+
return wrapError("set mount propagation to slave in new mount namespace", err)
375380
}
376381

377382
xdgRuntimeDir, err := homedir.GetRuntimeDir()

0 commit comments

Comments
 (0)