Line 5: |
Line 5: |
| | | |
| = The solution = | | = The solution = |
− | When we see all these variation of commands to build a mount tree, we can understand that the final picture may be very complicated to be repeated, so we suggest to add a new flag to the mount() syscall, which allows us to add a mount into an existing group. | + | When we see all variation of commands to build a mount tree, we can understand that the final picture may be very complicated to be repeated, so we suggest to add [https://patchwork.kernel.org/patch/9703885/ a new flag] to the mount() syscall, which allows us to add a mount into an existing group. |
| | | |
| In this case the restore algorithm will be very simple. | | In this case the restore algorithm will be very simple. |
− | Create a temporary mount which is called “root yard” | + | * Create a temporary mount which is called “root yard” |
− | Create all namespaces (in specified user namespaces) | + | * Create all namespaces (in specified user namespaces) |
− | Add root yards from all namespaces into one shared group, so a mount is created in one mntns, will be propagated into others. | + | * Add root yards from all namespaces into one shared group, so a mount is created in one mntns, will be propagated into others. |
− | Create all mounts in separate directories in the root yards. | + | * Create all mounts in separate directories in the root yards. |
− | Restore opened files (nothing is over-mounted at this point) | + | * Restore opened files (nothing is over-mounted at this point) |
− | Build mount trees in namespaces by moving mounts to right places | + | * Build mount trees in namespaces by moving mounts to right places |
− | Do pivot_root() in all namespaces | + | * Do pivot_root() in all namespaces |
| | | |
| Let’s look at the next example: | | Let’s look at the next example: |
Line 87: |
Line 87: |
| | | |
| [[File:mntns-2.0-tree-3.svg]] | | [[File:mntns-2.0-tree-3.svg]] |
− |
| |
| | | |
| = Restore of unix sockets = | | = Restore of unix sockets = |