From a017ada68b6db772b7ff5eccb645056c44a01693 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Mon, 4 Dec 2017 14:24:35 -0500 Subject: [PATCH 1/2] Don't append the container id to custom directory checkpoints. Fixes #34601. Signed-off-by: Ross Boucher Upstream-commit: e51aec992624fec305176866f3937e0a120cecb8 Component: engine --- components/engine/daemon/checkpoint.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/daemon/checkpoint.go b/components/engine/daemon/checkpoint.go index 482e3b848e..78930de4de 100644 --- a/components/engine/daemon/checkpoint.go +++ b/components/engine/daemon/checkpoint.go @@ -22,7 +22,7 @@ func getCheckpointDir(checkDir, checkpointID, ctrName, ctrID, ctrCheckpointDir s var checkpointDir string var err2 error if checkDir != "" { - checkpointDir = filepath.Join(checkDir, ctrID, "checkpoints") + checkpointDir = checkDir } else { checkpointDir = ctrCheckpointDir } From 2bb414da6ffb25d2a2733a006e4fdc9fa8565a48 Mon Sep 17 00:00:00 2001 From: Chanhun Jeong Date: Thu, 14 Dec 2017 17:52:37 +0900 Subject: [PATCH 2/2] skip container ID remapping, if the file is overlayfs whiteout. Signed-off-by: Chanhun Jeong Upstream-commit: b013c1541d3b58f736bc79269aa88d3bfacda6ea Component: engine --- components/engine/pkg/archive/archive.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/engine/pkg/archive/archive.go b/components/engine/pkg/archive/archive.go index aa55637565..a0c25937c8 100644 --- a/components/engine/pkg/archive/archive.go +++ b/components/engine/pkg/archive/archive.go @@ -456,10 +456,16 @@ func (ta *tarAppender) addTarFile(path, name string) error { } } + //check whether the file is overlayfs whiteout + //if yes, skip re-mapping container ID mappings. + isOverlayWhiteout := fi.Mode()&os.ModeCharDevice != 0 && hdr.Devmajor == 0 && hdr.Devminor == 0 + //handle re-mapping container ID mappings back to host ID mappings before //writing tar headers/files. We skip whiteout files because they were written //by the kernel and already have proper ownership relative to the host - if !strings.HasPrefix(filepath.Base(hdr.Name), WhiteoutPrefix) && !ta.IDMappings.Empty() { + if !isOverlayWhiteout && + !strings.HasPrefix(filepath.Base(hdr.Name), WhiteoutPrefix) && + !ta.IDMappings.Empty() { fileIDPair, err := getFileUIDGID(fi.Sys()) if err != nil { return err