mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
0b983ff832
This is the first in a series of changes that will enabled shared mount subtrees. This will emulate the Linux kernel implementation described here: https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt Mounts can now a be part of a mount groups. These groups are identified by ids assigned by the VFS. Group IDs can be reused after all mounts that are a member of that group are destroyed. Newly created mounts inherit the propagation type of their parent mount. A mount created on a shared mount will also be a shared mount, though it will be part of a different group. A shared mount 'A' bound to a shared mount 'B' will replicate that bind to all of 'B's peers. These new mounts will all be part of a new shared peer group. Unmounting a mount 'A' that is a direct child of a shared mount 'B' mounted at dentry 'b' will propagate that event to all its peers. So peers B1, B2, B3, etc will all unmount the mounts (A1, A2...) located at 'b'. However, if any of peers of A have children, they are skipped. If the original mount A has children, the mount is failed entirely. The initial root mount has propagation type MS_PRIVATE. This change only implements a basic version of mount groups. Notably it does not implement MS_SLAVE, MS_UNBINDABLE, or MS_REC. PiperOrigin-RevId: 483792757