rootfs: consolidate mountpoint creation logic#4359
Merged
AkihiroSuda merged 1 commit intoJul 29, 2024
Conversation
The logic for how we create mountpoints is spread over each mountpoint preparation function, when in reality the behaviour is pretty uniform with only a handful of exceptions. So just move it all to one function that is easier to understand. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
AkihiroSuda
reviewed
Jul 25, 2024
| // but properly handling the case where path or root are "/". | ||
| // | ||
| // NOTE: The return value only make sense if the path doesn't contain "..". | ||
| func IsLexicallyInRoot(root, path string) bool { |
Member
There was a problem hiding this comment.
I'm fine with adding them later, if that helps.
rata
approved these changes
Jul 25, 2024
| me := mountEntry{Mount: m} | ||
| // For all other filesystems, just make the target. | ||
| if _, err := createMountpoint(c.config.Rootfs, me); err != nil { | ||
| return fmt.Errorf("create criu restore mountpoint for %s mount: %w", me.Destination, err) |
Member
There was a problem hiding this comment.
nit: do we want to use %q for the destination here? It quotes the string, in case it has spaces and so
AkihiroSuda
approved these changes
Jul 29, 2024
Closed
This was referenced Sep 10, 2024
This was referenced Oct 7, 2024
This was referenced Oct 18, 2024
1 task
1 task
12 tasks
1 task
This was referenced Jul 7, 2025
1 task
1 task
1 task
12 tasks
This was referenced Sep 11, 2025
1 task
This was referenced Oct 21, 2025
This was referenced Dec 3, 2025
1 task
This was referenced Jan 7, 2026
1 task
This was referenced Mar 9, 2026
This was referenced Mar 19, 2026
1 task
This was referenced Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The logic for how we create mountpoints is spread over each mountpoint preparation function, when in reality the behaviour is pretty uniform with only a handful of exceptions. So just move it all to one function that is easier to understand.
Signed-off-by: Aleksa Sarai cyphar@cyphar.com