namespace-util: set mounts back to MS_SHARED in detach_mount_namespace()
authorLennart Poettering <lennart@poettering.net>
Mon, 13 Mar 2023 14:16:55 +0000 (15:16 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 14 Mar 2023 04:02:51 +0000 (13:02 +0900)
commitb6904196a6506cf3dcbe4c90f56b7e77434e7db4
tree9adbb9af71722683bf2a143d5be661cf5fa1037b
parent874cdcbcf5eb233a45b56b4e09e19defc4be9a0e
namespace-util: set mounts back to MS_SHARED in detach_mount_namespace()

For nspawn and services we first turn off two-way propagation of mounts
from host to sandbox via MS_SLAVE, and then set MS_SHARED again, so that
we create a new mount prop peer group again, and that we provide
behaviour similar to what we provide on the host further down the tree.

Let's do the same in detach_mount_namespace(), which we use for the
temporary mounts in the implementation of --image= in various tools.

This doesn't fix any immediate issue, but ensures we expose somewhat
systematic behaviour: whenever we detach mount namespaces we always set
things back to MS_SLAVE in the child.
src/basic/namespace-util.c