Skip to content

Commit

Permalink
Merge pull request #2902 from liusdu/checkpoint
Browse files Browse the repository at this point in the history
checkpoint: resolve symlink for external bind mount
  • Loading branch information
Mrunal Patel committed Jun 25, 2021
2 parents 245fe2b + da22625 commit 1079288
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions libcontainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,9 @@ const descriptorsFilename = "descriptors.json"

func (c *linuxContainer) addCriuDumpMount(req *criurpc.CriuReq, m *configs.Mount) {
mountDest := strings.TrimPrefix(m.Destination, c.config.Rootfs)
if dest, err := securejoin.SecureJoin(c.config.Rootfs, mountDest); err == nil {
mountDest = dest[len(c.config.Rootfs):]
}
extMnt := &criurpc.ExtMountMap{
Key: proto.String(mountDest),
Val: proto.String(mountDest),
Expand Down
13 changes: 12 additions & 1 deletion tests/integration/checkpoint.bats
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,18 @@ function simple_cr() {
done
}

@test "checkpoint and restore " {
@test "checkpoint and restore" {
simple_cr
}

@test "checkpoint and restore (bind mount, destination is symlink)" {
mkdir -p rootfs/real/conf
ln -s /real/conf rootfs/conf
update_config ' .mounts += [{
source: ".",
destination: "/conf",
options: ["bind"]
}]'
simple_cr
}

Expand Down

0 comments on commit 1079288

Please sign in to comment.