On Wed, Apr 29, 2020 at 10:31 AM Max Reitz <mre...@redhat.com> wrote: > > On 28.04.20 21:15, Dr. David Alan Gilbert wrote:
> > So are you saying we need a: > > if (mount(NULL, "/", NULL, MS_REC | MS_SHARED, NULL) < 0) { > > > > and can this go straight after (1) ? > > Isn’t MS_SHARED and MS_SLAVE mutually exclusive, that is, both are just > different propagation types? So shouldn’t putting this after (1) be > effectively the same as replacing (1)? No, think of it more like a set of groups (mounts in a group have the same "shared:$ID" tag in /proc/self/mountinfo) and these groups being arranged into a tree, where child groups get propagation from the parent group (mounts have a "master:$PARENT_ID" tag), but not the other way round. So if a mount is part of a shared group and this group is also the child of another shared group, then it will have both a "shared:$ID" and a "master:$PARENT_ID" tag in /proc/self/mountinfo. For the gory details see Documentation/filesystems/sharedsubtree.txt Thanks, Miklos