Skip to content
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

overlay, composefs: use data-only lower layers #1713

Merged
merged 5 commits into from Oct 3, 2023

Conversation

giuseppe
Copy link
Member

use the new overlay data-only feature to mount the composefs data directory so there is no need for upper layers to create whiteouts to hide payload files.

The feature was added to Linux 6.5.

Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com

@nalind
Copy link
Member

nalind commented Sep 13, 2023

How is whether or not we can use a data-only lower layer determined? Is there a run-time feature test for this?

@giuseppe
Copy link
Member Author

How is whether or not we can use a data-only lower layer determined? Is there a run-time feature test for this?

I've added a run-time feature test. Without the data-only lower layers feature we are limited to mount only images with a single layer when using composefs. I don't think it is worth the extra complexity, so composefs is disabled when the feature is not present.

@alexlarsson PTAL

@giuseppe
Copy link
Member Author

we also need: #1712

@rhatdan
Copy link
Member

rhatdan commented Sep 14, 2023

#1712 is merged

}
// absLowers is not valid anymore now as we have added composeFsLayers to it, so prevent
// its usage.
absLowers = nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

linter says: ineffectual assignment about this

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@giuseppe
Copy link
Member Author

ready for review

@rhatdan
Copy link
Member

rhatdan commented Sep 17, 2023

LGTM
@nalind @mtrmac @alexlarsson @flouthoc PTAL

Copy link
Member

@nalind nalind left a comment

Choose a reason for hiding this comment

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

I'd really like a test that ensures that the driver does the right thing when the feature is available and asked for, even if it has to be skipped in CI in the short-term.

@giuseppe
Copy link
Member Author

I'd really like a test that ensures that the driver does the right thing when the feature is available and asked for, even if it has to be skipped in CI in the short-term.

Sure, I can add some tests. Do you think there is anything in particular we should test for? Once composefs is enabled, there should not be any visible difference for the users and the existing tests should still work

@nalind
Copy link
Member

nalind commented Sep 18, 2023

I'd really like a test that ensures that the driver does the right thing when the feature is available and asked for, even if it has to be skipped in CI in the short-term.

Sure, I can add some tests. Do you think there is anything in particular we should test for? Once composefs is enabled, there should not be any visible difference for the users and the existing tests should still work

Do we have tests that exercise using composefs layers as read-only layers?

@giuseppe
Copy link
Member Author

I'd really like a test that ensures that the driver does the right thing when the feature is available and asked for, even if it has to be skipped in CI in the short-term.

Sure, I can add some tests. Do you think there is anything in particular we should test for? Once composefs is enabled, there should not be any visible difference for the users and the existing tests should still work

Do we have tests that exercise using composefs layers as read-only layers?

I don't think it would be any different than the tests we already have, the only difference with composefs is that there will be more 2x lower layers (for each layer there is one overlay layer with the erofs file system and one for the data)

@giuseppe giuseppe marked this pull request as draft September 19, 2023 10:57
@giuseppe giuseppe marked this pull request as ready for review September 19, 2023 12:25
@rhatdan
Copy link
Member

rhatdan commented Sep 20, 2023

@mtrmac @nalind PTAL

@giuseppe
Copy link
Member Author

thanks, comments addressed in the current version

@giuseppe
Copy link
Member Author

can I get another review?

Copy link
Contributor

@alexlarsson alexlarsson left a comment

Choose a reason for hiding this comment

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

Minor comments, but looks good to me.

drivers/overlay/check.go Show resolved Hide resolved
cmd/containers-storage/diff.go Outdated Show resolved Hide resolved
@rhatdan
Copy link
Member

rhatdan commented Sep 26, 2023

@alexlarsson @nalind PTANL

Copy link
Contributor

@alexlarsson alexlarsson left a comment

Choose a reason for hiding this comment

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

lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexlarsson, giuseppe

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

The pull request process is described here

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
Member

rhatdan commented Sep 27, 2023

@mtrmac @nalind another review?

if d.options.mountOptions is the empty string, we should not append an
empty option.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
use the new overlay data-only feature to mount the composefs data
directory so there is no need for upper layers to create whiteouts to
hide payload files.

The feature was added to Linux 6.5.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Member Author

giuseppe commented Oct 2, 2023

rebased, can you please take another look?

@giuseppe
Copy link
Member Author

giuseppe commented Oct 2, 2023

@nalind could you please take another look?

dataOnly := false
for _, lowerPath := range lowers {
if lowerPath == "" {
dataOnly = true
Copy link
Member

Choose a reason for hiding this comment

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

Should this loop be enforcing the "once we see a data-only layer, they should all be data-only layers" requirement that the kernel has?

Copy link
Member Author

Choose a reason for hiding this comment

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

not sure, if the input is not correct we'd get a similar error from Mount as we do if we call directly the syscall and we are not doing any validation in the mountOverlayFromMain function.

I don't think we need it, but if you prefer to have it, I'll add it

Copy link
Member

Choose a reason for hiding this comment

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

It's not a blocker for me so long as it's something we thought about, and not a "we didn't think of that" that becomes a problem later on.

tests/apply-diff.bats Outdated Show resolved Hide resolved
add a new command to exercise the ApplyDiff from a staging directory.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@nalind
Copy link
Member

nalind commented Oct 3, 2023

LGTM

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 3, 2023

/lgtm

(reflecting others’ reviews, really)

@openshift-ci openshift-ci bot added the lgtm label Oct 3, 2023
@rhatdan rhatdan merged commit 19c3c10 into containers:main Oct 3, 2023
18 of 19 checks passed
@cgwalters cgwalters added the area/composefs composefs related changes label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/composefs composefs related changes lgtm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants