Signed-off-by: Chanhun Jeong <chanhun.jeong@navercorp.com>
| ... | ... |
@@ -456,10 +456,16 @@ func (ta *tarAppender) addTarFile(path, name string) error {
|
| 456 | 456 |
} |
| 457 | 457 |
} |
| 458 | 458 |
|
| 459 |
+ //check whether the file is overlayfs whiteout |
|
| 460 |
+ //if yes, skip re-mapping container ID mappings. |
|
| 461 |
+ isOverlayWhiteout := fi.Mode()&os.ModeCharDevice != 0 && hdr.Devmajor == 0 && hdr.Devminor == 0 |
|
| 462 |
+ |
|
| 459 | 463 |
//handle re-mapping container ID mappings back to host ID mappings before |
| 460 | 464 |
//writing tar headers/files. We skip whiteout files because they were written |
| 461 | 465 |
//by the kernel and already have proper ownership relative to the host |
| 462 |
- if !strings.HasPrefix(filepath.Base(hdr.Name), WhiteoutPrefix) && !ta.IDMappings.Empty() {
|
|
| 466 |
+ if !isOverlayWhiteout && |
|
| 467 |
+ !strings.HasPrefix(filepath.Base(hdr.Name), WhiteoutPrefix) && |
|
| 468 |
+ !ta.IDMappings.Empty() {
|
|
| 463 | 469 |
fileIDPair, err := getFileUIDGID(fi.Sys()) |
| 464 | 470 |
if err != nil {
|
| 465 | 471 |
return err |