From 957068c6abc5717ab552323404c9f5fed9793947 Mon Sep 17 00:00:00 2001 From: Burke Libbey Date: Tue, 5 May 2015 11:06:54 -0400 Subject: [PATCH] ino and dev must both match for a file to be identical. This case is triggered frequently on ZFS. Signed-off-by: Burke Libbey Upstream-commit: 03956610e588057e903288b8fb50df46c8d8f5d9 Component: engine --- components/engine/pkg/archive/changes_linux.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/engine/pkg/archive/changes_linux.go b/components/engine/pkg/archive/changes_linux.go index b1d34b31b1..dee8b7c604 100644 --- a/components/engine/pkg/archive/changes_linux.go +++ b/components/engine/pkg/archive/changes_linux.go @@ -100,6 +100,15 @@ func (w *walker) walk(path string, i1, i2 os.FileInfo) (err error) { is1Dir := i1 != nil && i1.IsDir() is2Dir := i2 != nil && i2.IsDir() + sameDevice := false + if i1 != nil && i2 != nil { + si1 := i1.Sys().(*syscall.Stat_t) + si2 := i2.Sys().(*syscall.Stat_t) + if si1.Dev == si2.Dev { + sameDevice = true + } + } + // If these files are both non-existent, or leaves (non-dirs), we are done. if !is1Dir && !is2Dir { return nil @@ -144,7 +153,7 @@ func (w *walker) walk(path string, i1, i2 os.FileInfo) (err error) { names = append(names, ni1.name) ix1++ case 0: // ni1 == ni2 - if ni1.ino != ni2.ino { + if ni1.ino != ni2.ino || !sameDevice { names = append(names, ni1.name) } ix1++