From f91fbd34d9e819a833c7da00c6c88f5371a82ac5 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 13 May 2025 19:52:18 -0700 Subject: [PATCH] criu: inline makeCriuRestoreMountpoints Since its code is now trivial, and it is only called from a single place, it does not make sense to have it as a separate function. Signed-off-by: Kir Kolyshkin --- libcontainer/criu_linux.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/libcontainer/criu_linux.go b/libcontainer/criu_linux.go index af7e2eed2..92a93e75f 100644 --- a/libcontainer/criu_linux.go +++ b/libcontainer/criu_linux.go @@ -523,18 +523,6 @@ func (c *Container) restoreNetwork(req *criurpc.CriuReq, criuOpts *CriuOpts) { } } -// makeCriuRestoreMountpoints makes the actual mountpoints for the -// restore using CRIU. This function is inspired from the code in -// rootfs_linux.go. -func (c *Container) makeCriuRestoreMountpoints(m *configs.Mount) error { - // TODO: pass srcFD? Not sure if criu is impacted by issue #2484. - me := mountEntry{Mount: m} - if _, err := createMountpoint(c.config.Rootfs, me); err != nil { - return fmt.Errorf("create criu restore mountpoint for %s mount: %w", me.Destination, err) - } - return nil -} - // isPathInPrefixList is a small function for CRIU restore to make sure // mountpoints, which are on a tmpfs, are not created in the roofs. func isPathInPrefixList(path string, prefix []string) bool { @@ -591,8 +579,8 @@ func (c *Container) prepareCriuRestoreMounts(mounts []*configs.Mount) error { if isPathInPrefixList(m.Destination, tmpfs) { continue } - if err := c.makeCriuRestoreMountpoints(m); err != nil { - return err + if _, err := createMountpoint(c.config.Rootfs, mountEntry{Mount: m}); err != nil { + return fmt.Errorf("create criu restore mountpoint for %s mount: %w", m.Destination, err) } // If the mount point is a bind mount, we need to mount // it now so that runc can create the necessary mount