Skip to content

chunked: skip file metadata for composefs-like links#1862

Merged
openshift-merge-bot[bot] merged 4 commits intocontainers:mainfrom
giuseppe:composefs-no-setattrs
Mar 20, 2024
Merged

chunked: skip file metadata for composefs-like links#1862
openshift-merge-bot[bot] merged 4 commits intocontainers:mainfrom
giuseppe:composefs-no-setattrs

Conversation

@giuseppe
Copy link
Copy Markdown
Member

if the file is created using the object-store flat directory format, there is no need to set its inodes attributes, as anyway they are ignored when creating the composefs binary blob.

Similarly, we do not need to set file attributes when the deduplication happened through a hard link.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Mar 15, 2024

LGTM
@mtrmac @alexlarsson @cgwalters PTAL

@cgwalters
Copy link
Copy Markdown
Contributor

Apart from the other comment, this seems sane; are there no integration tests that run with composefs enabled on this repo? It seems like it wouldn't be too hard to add a test for this if so. (And if not, probably need integration coverage for chunked/composefs here)

Copy link
Copy Markdown
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, the code to check whether the hardlink destination matches the expected attributes (canDedupFileWithHardLink?) and this code to set/not set the attributes are way too distant for me to be comfortable; I’m not smart enough to believe I would be able to keep the two in sync long-term.

@giuseppe giuseppe force-pushed the composefs-no-setattrs branch from b17932f to c80d63b Compare March 16, 2024 22:19
@giuseppe
Copy link
Copy Markdown
Member Author

Apart from the other comment, this seems sane; are there no integration tests that run with composefs enabled on this repo? It seems like it wouldn't be too hard to add a test for this if so. (And if not, probably need integration coverage for chunked/composefs here)

this is still something we miss, as we don't have any test for composefs

@giuseppe giuseppe force-pushed the composefs-no-setattrs branch from c80d63b to 2cc31aa Compare March 16, 2024 22:21
@giuseppe giuseppe marked this pull request as draft March 16, 2024 22:21
@giuseppe giuseppe marked this pull request as ready for review March 18, 2024 20:08
Copy link
Copy Markdown
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice.

Apart from comment around internal.ChunkTypeData (to consistently never use the internal fileMetadata for TypeChunk values), all others are just tentative aesthetic suggestions.


// setFileAttrs sets the file attributes for file given metadata
func setFileAttrs(dirfd int, file *os.File, mode os.FileMode, metadata *internal.FileMetadata, options *archive.TarOptions, usePath bool) error {
func setFileAttrs(dirfd int, file *os.File, mode os.FileMode, metadata *fileMetadata, options *archive.TarOptions, usePath bool) error {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Unrelated: if I’m not mistaken, mode is always os.FileMode(metadata.Mode), so the parameter could be eliminated throughout the call stack. Perhaps best to do in a separate PR.)

@giuseppe giuseppe force-pushed the composefs-no-setattrs branch 3 times, most recently from 84b261e to c047434 Compare March 19, 2024 21:15
@giuseppe
Copy link
Copy Markdown
Member Author

thanks, took care of the comments (except #1862 (comment) ) and pushed a new version

Copy link
Copy Markdown
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

LGTM, feel free to merge as is or add that small cleanup.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
when it is set, only the file payload is written, but the inode
attributes are ignored.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
if a file was deduplicated with a hard link, do not override its
metadata.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
if the file is created using the object-store flat directory format,
there is no need to set its inodes attributes, as anyway they are
ignored when creating the composefs binary blob.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe giuseppe force-pushed the composefs-no-setattrs branch from c047434 to 1126d65 Compare March 20, 2024 14:50
@mtrmac
Copy link
Copy Markdown
Collaborator

mtrmac commented Mar 20, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Mar 20, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit b0c3d96 into containers:main Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants