Skip to content

Commit

Permalink
Merge pull request containers#230 from giuseppe/use-aufs-whiteout-for…
Browse files Browse the repository at this point in the history
…-fuse-overlayfs

overlay: use AUFS whiteout format when using mount_program
  • Loading branch information
giuseppe authored Nov 12, 2018
2 parents c57ac62 + cd40ccc commit 46a6d79
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,17 @@ func (d *Driver) isParent(id, parent string) bool {
return ld == parentDir
}

func (d *Driver) getWhiteoutFormat() archive.WhiteoutFormat {
whiteoutFormat := archive.OverlayWhiteoutFormat
if d.options.mountProgram != "" {
// If we are using a mount program, we are most likely running
// as an unprivileged user that cannot use mknod, so fallback to the
// AUFS whiteout format.
whiteoutFormat = archive.AUFSWhiteoutFormat
}
return whiteoutFormat
}

// ApplyDiff applies the new layer into a root
func (d *Driver) ApplyDiff(id string, idMappings *idtools.IDMappings, parent string, mountLabel string, diff io.Reader) (size int64, err error) {
if !d.isParent(id, parent) {
Expand All @@ -862,7 +873,7 @@ func (d *Driver) ApplyDiff(id string, idMappings *idtools.IDMappings, parent str
if err := untar(diff, applyDir, &archive.TarOptions{
UIDMaps: idMappings.UIDs(),
GIDMaps: idMappings.GIDs(),
WhiteoutFormat: archive.OverlayWhiteoutFormat,
WhiteoutFormat: d.getWhiteoutFormat(),
}); err != nil {
return 0, err
}
Expand Down Expand Up @@ -915,7 +926,7 @@ func (d *Driver) Diff(id string, idMappings *idtools.IDMappings, parent string,
Compression: archive.Uncompressed,
UIDMaps: idMappings.UIDs(),
GIDMaps: idMappings.GIDs(),
WhiteoutFormat: archive.OverlayWhiteoutFormat,
WhiteoutFormat: d.getWhiteoutFormat(),
WhiteoutData: lowerDirs,
})
}
Expand Down

0 comments on commit 46a6d79

Please sign in to comment.