fs: enable to select the correct opaque xattr #681
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, stargz-snapshotter's filesystem adds both
"trusted.overlay.opaque"
and"user.overlay.opaque"
to each opaque directory. But overlayfs uses either"trusted.overlay.opaque"
(userxattr=false) or"user.overlay.opaque"
(userxattr=true) for the opaque xattr and prevents it to be copied up to the upper. Thus the other (i.e."user.overlay.opaque"
when userxattr=false or"trusted.overlay.opaque"
when userxattr=true) is treated as a normal xattr and can be copied up.This behaviour of copying up of the xattr is problematic for BuildKit's overlayfs differ because it mistakenly treats a dir with the copied up opaque xattr as an opaque dir and creates unnecessary whiteout files. (this causes moby/buildkit#2720.)
This commit fixes this issue by allowing the caller of
fs.NewFilesystem
(e.g. BuildKit) to choose whether of"user.overlay.opaque"
or"trusted.overlay.opaque"
(or the both) to use for the opaque dir. If the caller usesuserxattr
option for overlayfs, it should specify"user.overlay.opaque"
. If not, should specify"trusted.overlay.opaque"
.This issue can be reproduced with the example provided by moby/buildkit#2720.
The last build fails:
The exported cache contains an unnecessary whitout for
usr/local/lib/python3.9/site-packages/pip/_internal/cli/main.py
.