mount: support idmapped mount points
This patch introduces idmapped mounts support for container rootfs. The idmapped mounts support was merged in Linux kernel 5.12 torvalds/linux@7d6beb7. This functionality allows to address chown overhead for containers that use user namespace. The changes are based on experimental patchset published by Mauricio Vásquez #4734. Current version reiplements support of idmapped mounts using Golang. Performance measurement results: Image idmapped mount recursive chown BusyBox 00.135 04.964 Ubuntu 00.171 15.713 Fedora 00.143 38.799 Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io> Signed-off-by: Artem Kuzin <artem.kuzin@huawei.com> Signed-off-by: Alexey Perevalov <alexey.perevalov@huawei.com> Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
This commit is contained in:
@@ -186,8 +186,9 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
opts = append(opts,
|
||||
oci.WithUserNamespace([]specs.LinuxIDMapping{uidMap}, []specs.LinuxIDMapping{gidMap}))
|
||||
// use snapshotter opts or the remapped snapshot support to shift the filesystem
|
||||
// currently the only snapshotter known to support the labels is fuse-overlayfs:
|
||||
// https://github.com/AkihiroSuda/containerd-fuse-overlayfs
|
||||
// currently the snapshotters known to support the labels are:
|
||||
// fuse-overlayfs - https://github.com/containerd/fuse-overlayfs-snapshotter
|
||||
// overlay - in case of idmapped mount points are supported by host kernel (Linux kernel 5.19)
|
||||
if context.Bool("remap-labels") {
|
||||
cOpts = append(cOpts, containerd.WithNewSnapshot(id, image,
|
||||
containerd.WithRemapperLabels(0, uidMap.HostID, 0, gidMap.HostID, uidMap.Size)))
|
||||
|
||||
Reference in New Issue
Block a user