Skip to content

Commit

Permalink
overlay: always honor mountProgram
Browse files Browse the repository at this point in the history
if a mountProgram is specified, use it also in rootfull mode.

Closes: containers#3281

[NO NEW TESTS NEEDED]

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jan 27, 2022
1 parent 5a25fc6 commit 4d0eb18
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions pkg/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,21 @@ func MountWithOptions(contentDir, source, dest string, opts *Options) (mount spe
overlayOptions = fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s,private", escapeColon(source), upperDir, workDir)
}

if unshare.IsRootless() {
mountProgram := findMountProgram(opts.GraphOpts)
if mountProgram != "" {
if err := mountWithMountProgram(mountProgram, overlayOptions, mergeDir); err != nil {
return mount, err
}

mount.Source = mergeDir
mount.Destination = dest
mount.Type = "bind"
mount.Options = []string{"bind", "slave"}
return mount, nil
mountProgram := findMountProgram(opts.GraphOpts)
if mountProgram != "" {
if err := mountWithMountProgram(mountProgram, overlayOptions, mergeDir); err != nil {
return mount, err
}
/* If a mount_program is not specified, fallback to try mount native overlay. */

mount.Source = mergeDir
mount.Destination = dest
mount.Type = "bind"
mount.Options = []string{"bind", "slave"}
return mount, nil
}

if unshare.IsRootless() {
/* If a mount_program is not specified, fallback to try mounting native overlay. */
overlayOptions = fmt.Sprintf("%s,userxattr", overlayOptions)
}

Expand Down

0 comments on commit 4d0eb18

Please sign in to comment.