diff --git a/checkpoint.go b/checkpoint.go index 733a145c..e7664a13 100644 --- a/checkpoint.go +++ b/checkpoint.go @@ -20,6 +20,7 @@ var checkpointCommand = cli.Command{ cli.BoolFlag{Name: "ext-unix-sk", Usage: "allow external unix sockets"}, cli.BoolFlag{Name: "shell-job", Usage: "allow shell jobs"}, cli.StringFlag{Name: "page-server", Value: "", Usage: "ADDRESS:PORT of the page server"}, + cli.BoolFlag{Name: "file-locks", Usage: "handle file locks, for safety"}, }, Action: func(context *cli.Context) { container, err := getContainer(context) diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index d58624c6..7d9fa71a 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -344,6 +344,7 @@ func (c *linuxContainer) Checkpoint(criuOpts *CriuOpts) error { LeaveRunning: proto.Bool(criuOpts.LeaveRunning), TcpEstablished: proto.Bool(criuOpts.TcpEstablished), ExtUnixSk: proto.Bool(criuOpts.ExternalUnixConnections), + FileLocks: proto.Bool(criuOpts.FileLocks), } // append optional criu opts, e.g., page-server and port @@ -463,6 +464,7 @@ func (c *linuxContainer) Restore(process *Process, criuOpts *CriuOpts) error { ShellJob: proto.Bool(criuOpts.ShellJob), ExtUnixSk: proto.Bool(criuOpts.ExternalUnixConnections), TcpEstablished: proto.Bool(criuOpts.TcpEstablished), + FileLocks: proto.Bool(criuOpts.FileLocks), }, } for _, m := range c.config.Mounts { diff --git a/libcontainer/criu_opts.go b/libcontainer/criu_opts.go index 9e9563e7..bca81672 100644 --- a/libcontainer/criu_opts.go +++ b/libcontainer/criu_opts.go @@ -12,5 +12,6 @@ type CriuOpts struct { TcpEstablished bool // checkpoint/restore established TCP connections ExternalUnixConnections bool // allow external unix connections ShellJob bool // allow to dump and restore shell jobs + FileLocks bool // handle file locks, for safety PageServer CriuPageServerInfo // allow to dump to criu page server } diff --git a/restore.go b/restore.go index b186bbf4..e604895f 100644 --- a/restore.go +++ b/restore.go @@ -21,6 +21,7 @@ var restoreCommand = cli.Command{ cli.BoolFlag{Name: "tcp-established", Usage: "allow open tcp connections"}, cli.BoolFlag{Name: "ext-unix-sk", Usage: "allow external unix sockets"}, cli.BoolFlag{Name: "shell-job", Usage: "allow shell jobs"}, + cli.BoolFlag{Name: "file-locks", Usage: "handle file locks, for safety"}, }, Action: func(context *cli.Context) { imagePath := context.String("image-path") @@ -109,6 +110,7 @@ func criuOptions(context *cli.Context) *libcontainer.CriuOpts { TcpEstablished: true, // context.Bool("tcp-established"), ExternalUnixConnections: context.Bool("ext-unix-sk"), ShellJob: context.Bool("shell-job"), + FileLocks: context.Bool("file-locks"), } }