mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-26 19:41:35 +08:00
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 <kolyshkin@gmail.com>
(cherry picked from commit f91fbd34d9
)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user