-
Notifications
You must be signed in to change notification settings - Fork 83
RFC: overlay dirmeta_delegate design #701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,12 @@ type ( | |
| ForceMask *os.FileMode | ||
| // Timestamp, if set, will be set in each header as create/mod/access time | ||
| Timestamp *time.Time | ||
| // DirmetaDelegate, if set, causes implicitly-created parent directories | ||
| // (structural directories not present as entries in the tar stream) to be | ||
| // marked with the overlay dirmeta_delegate xattr. This tells overlayfs to | ||
| // delegate metadata (timestamps, ownership, mode) for these directories to | ||
| // a lower layer, preserving the meaningful metadata from base image layers. | ||
| DirmetaDelegate bool | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if no layer contains an entry for the parent directory?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As written today, if it cannot find a non-delegated entry in any of the lowerdirs, it will fall back to the current behavior of using whatever metadata happens to be present on the topmost dir in the stack. That could be subject to change during kernel review though.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also a question for the OCI spec… |
||
| } | ||
| ) | ||
|
|
||
|
|
@@ -1135,7 +1141,11 @@ loop: | |
| parent := filepath.Dir(hdr.Name) | ||
| parentPath := filepath.Join(dest, parent) | ||
| if err := fileutils.Lexists(parentPath); err != nil && os.IsNotExist(err) { | ||
| err = idtools.MkdirAllAndChownNew(parentPath, 0o777, rootIDs) | ||
| if options.DirmetaDelegate { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess there could be a cleaner implementation but I don’t worry about that now. |
||
| err = mkdirAllAndChownWithDirmetaDelegate(parentPath, 0o777, rootIDs) | ||
| } else { | ||
| err = idtools.MkdirAllAndChownNew(parentPath, 0o777, rootIDs) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if a layer (this one or a later one) contains a directory entry for one of the intermediate directories after we create it? I suppose we should clean the attribute.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this is a good point, if the ordering of the tar stream in this particular layer is something like... We would need to set the xattr on If instead it's spread across two layers, like:
Then I don't think there needs to be any special handling because when traversing through the lowerdir stack overlay will find But more generally this is precisely the sort of thing that the OCI spec should address and clarify. |
||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t know why this should be an option, conceptually the images should have a single set of semantics. (Now, following that thought strictly, either all existing implementations are violating the spec, or the spec needs to specify the existing behavior and the new feature should not be adopted … but let’s ignore that.)
Who would want to set this on/off, per host? (I can imagine per-image, although that would be a totally unreasonable hassle, but per host just looks like a wrong scope for the decision.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no strong opinions on the configurability of this, it's only like this because doing AI iteration it asked how it should work and I said to have it on by default but be able to disable it with the config. But the only real reason I did that was for my own testing purposes.