Skip to content

Commit

Permalink
overlay: fix check for rootless native diff
Browse files Browse the repository at this point in the history
make sure "userxattr" is specified, otherwise the "user.overlay."
xattrs are not treated specially and copied up as for the root case.

Closes: #947

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jun 22, 2021
1 parent b83d218 commit 1e81ec1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/overlay/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ func doesSupportNativeDiff(d, mountOpts string) error {
return errors.Wrap(err, "failed to set opaque flag on middle layer")
}

opts := fmt.Sprintf("lowerdir=%s:%s,upperdir=%s,workdir=%s", path.Join(td, "l2"), path.Join(td, "l1"), path.Join(td, "l3"), path.Join(td, "work"))
mountFlags := "lowerdir=%s:%s,upperdir=%s,workdir=%s"
if unshare.IsRootless() {
mountFlags = mountFlags + ",userxattr"
}

opts := fmt.Sprintf(mountFlags, path.Join(td, "l2"), path.Join(td, "l1"), path.Join(td, "l3"), path.Join(td, "work"))
flags, data := mount.ParseOptions(mountOpts)
if data != "" {
opts = fmt.Sprintf("%s,%s", opts, data)
Expand Down

0 comments on commit 1e81ec1

Please sign in to comment.