Skip to content

Commit 3e4024c

Browse files
committed
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 <[email protected]>
1 parent c51bc04 commit 3e4024c

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

libcontainer/criu_linux.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -523,18 +523,6 @@ func (c *Container) restoreNetwork(req *criurpc.CriuReq, criuOpts *CriuOpts) {
523523
}
524524
}
525525

526-
// makeCriuRestoreMountpoints makes the actual mountpoints for the
527-
// restore using CRIU. This function is inspired from the code in
528-
// rootfs_linux.go.
529-
func (c *Container) makeCriuRestoreMountpoints(m *configs.Mount) error {
530-
// TODO: pass srcFD? Not sure if criu is impacted by issue #2484.
531-
me := mountEntry{Mount: m}
532-
if _, err := createMountpoint(c.config.Rootfs, me); err != nil {
533-
return fmt.Errorf("create criu restore mountpoint for %s mount: %w", me.Destination, err)
534-
}
535-
return nil
536-
}
537-
538526
// isPathInPrefixList is a small function for CRIU restore to make sure
539527
// mountpoints, which are on a tmpfs, are not created in the roofs.
540528
func isPathInPrefixList(path string, prefix []string) bool {
@@ -591,8 +579,8 @@ func (c *Container) prepareCriuRestoreMounts(mounts []*configs.Mount) error {
591579
if isPathInPrefixList(m.Destination, tmpfs) {
592580
continue
593581
}
594-
if err := c.makeCriuRestoreMountpoints(m); err != nil {
595-
return err
582+
if _, err := createMountpoint(c.config.Rootfs, mountEntry{Mount: m}); err != nil {
583+
return fmt.Errorf("create criu restore mountpoint for %s mount: %w", m.Destination, err)
596584
}
597585
// If the mount point is a bind mount, we need to mount
598586
// it now so that runc can create the necessary mount

0 commit comments

Comments
 (0)