-
Notifications
You must be signed in to change notification settings - Fork 839
RUN: only use an overlay for --mount=type=bind,rw on overlay #6126
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?
Conversation
6084d5f
to
b81b006
Compare
Ephemeral COPR build failed. @containers/packit-build please check. |
86b6879
to
f0e6488
Compare
04b80e1
to
e62f77c
Compare
dad02e0
to
5dd5313
Compare
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 only gave this a quick skim and I don't know the code really, but FWIW looks sane to me.
@@ -118,6 +120,87 @@ func convertToOverlay(m specs.Mount, store storage.Store, mountLabel, tmpDir str | |||
return mountThisInstead, overlayDir, nil | |||
} | |||
|
|||
func makeTempCopy(m specs.Mount, tmpDir string, uid, gid int) (specs.Mount, string, error) { |
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.
This function seems like it could use a doc comment.
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.
Added one.
@nalind looks lke you need an update here. |
tests/run.bats
Outdated
@@ -420,23 +420,23 @@ function configure_and_check_user() { | |||
cid=$output | |||
mkdir -p ${TEST_SCRATCH_DIR}/was:empty | |||
# As a baseline, this should succeed. | |||
run_buildah run --mount type=tmpfs,dst=/var/tmpfs-not-empty $cid touch /var/tmpfs-not-empty/testfile | |||
run_buildah run --mount type=tmpfs,dst=/var/tmpfs-not-empty $cid touch /var/tmpfs-not-empty/testfile |
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.
Not blocking: I'm not sure if the spaces are intentional, but if they are to improve readability. It might be better to move the value of the --mount
argument to a separate variable.
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.
Ah, that does help. Thanks!
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.
Thanks, LGTM. I haven't noticed any problems. I think a rebase will be necessary.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Honny1, nalind 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 |
Expand our task that runs the integration tests inside of a container from running buildah-using-vfs-inside-podman-using-vfs and buildah-using-overlay-inside-podman-using-overlay to also test vfs over overlay, and overlay over vfs. Signed-off-by: Nalin Dahyabhai <[email protected]>
Only use an overlay for --mounts of type=bind,rw, where changes should be discarded, if the storage driver is overlay. Otherwise, make a temporary copy and use a bind mount to the copy. Signed-off-by: Nalin Dahyabhai <[email protected]>
If we're forcing a mount using overlay, but we fail, and our chosen upper directory is on overlay, try using fuse-overlayfs. Signed-off-by: Nalin Dahyabhai <[email protected]>
Force the mount of the overlay in runSetupVolumeMounts() so that we can take advantage of logic that tries to use fuse-overlayfs if we happen to be on top of overlay, which would otherwise fail. Signed-off-by: Nalin Dahyabhai <[email protected]>
Force the mount of the overlay in volumeCacheSaveOverlay(), and clean it up in volumeCacheRestoreOverlay(), so that we can take advantage of logic that tries to use fuse-overlayfs if we happen to be on top of overlay, which would otherwise fail. Signed-off-by: Nalin Dahyabhai <[email protected]>
Drop the conditional ,z that we were trying to add when testing the -v flag with the "O" option, the combination of which is not allowed by github.com/containers/common/pkg/parse.ValidateVolumeOpts(). Signed-off-by: Nalin Dahyabhai <[email protected]>
When grepping the mounts list for the root mount, also accept the entry if "rw" is the only flag. Signed-off-by: Nalin Dahyabhai <[email protected]>
If we're on overlayfs, we can't use the directory name that we'd like to use as part of the test and expect things to succeed, even if we try to work around it using fuse-overlayfs. Signed-off-by: Nalin Dahyabhai <[email protected]>
If we're on overlayfs, we can't use the directory name that we'd like to use as part of the test and expect things to succeed, even if we try to work around it using fuse-overlayfs. Signed-off-by: Nalin Dahyabhai <[email protected]>
When setting up a chroot using overlay, if the intended upper directory is already on an overlayfs, mount a tmpfs onto it so that we can finish setting up the chroot that's an overlayfs that we'll actually test in, and copy the base image into the storage that it'll use. Signed-off-by: Nalin Dahyabhai <[email protected]>
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 enough to judge the volumeCache…
part.
Overall, I suppose the added test coverage should be decisive.
if newMount, overlayDir, err = convertToOverlay(newMount, store, mountLabel, tmpDir, 0, 0); err != nil { | ||
return newMount, "", "", "", err | ||
switch store.GraphDriverName() { | ||
case "overlay": |
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.
(There is precedent for hard-coding a condition like this … but maybe the checks could all be consolidated into a single function.)
ForceMount: true, | ||
MountLabel: b.MountLabel, |
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.
Force the mount of the overlay in runSetupVolumeMounts() so that we can
take advantage of logic that tries to use fuse-overlayfs if we happen to
be on top of overlay, which would otherwise fail.
I read that as potentially unclean… if using fuse-overlay
this way is expected for an “overlay” mount, shouldn’t the consumer of the created specs.Mount
be able to handle that universally, instead of us special-casing it and adding an extra mount operation every time?
*shrug* I suppose changing all relevant OCI runtimes is unpalatable?
With this, every single caller in Buildah except for run_freebsd.go
(but not the callers in podman/libpod
) sets ForceMount
. Is that correct, or should the option be removed entirely?
A friendly reminder that this PR had no activity for 30 days. |
@nalind merge conflict here that needs some massaging. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Only use an overlay for --mounts of type=bind,rw, where changes should be discarded, if the storage driver is overlay. Otherwise, make a temporary copy.
How to verify it
Updated CI to test {vfs|overlay} over {vfs|overlay}, which would have caught this.
Which issue(s) this PR fixes:
Should fix #5988.
Special notes for your reviewer:
Basically what #5988 (comment) suggested.
Does this PR introduce a user-facing change?