-
Notifications
You must be signed in to change notification settings - Fork 2.9k
rootless: use nsfs file handles to persist namespaces #27880
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
88d18ef to
65d8b55
Compare
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
2 similar comments
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
d53f620 to
0dcca5e
Compare
|
@containers/podman-maintainers tests are passing, ready for review |
libpod/runtime_migrate_linux.go
Outdated
| } | ||
|
|
||
| nsHandlesPath := rootless.GetNamespaceHandlesPath(stateDir) | ||
| _ = os.Remove(nsHandlesPath) |
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.
should this be logged in any way?
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 a warning
|
|
||
| // GetNamespaceHandlesPath returns the path to the namespace handles file | ||
| // in the given state directory. | ||
| func GetNamespaceHandlesPath(stateDir string) string { |
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.
would it be good to drop a couple of unit tests here to prevent regression?
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
|
LGTM, I had a couple of sideways questions that you can decide on ... we should get somebody with more C to review this too. |
pkg/rootless/rootless_linux.c
Outdated
| int p[2]; | ||
| char pause_pid_file_path[PATH_MAX]; | ||
|
|
||
| snprintf (pause_pid_file_path, PATH_MAX, "%s/pause.pid", state_dir); |
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.
Would it make sense to also check for PATH_MAX here?
if (ret >= PATH_MAX)
{
errno = ENAMETOOLONG;
return -1;
}
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.
sure, added
|
What does this look like when upgrading from an older Podman without a restart? Will the user need a |
0dcca5e to
86f39f4
Compare
no, it will automatically join the pause process as we do now, then save the file with the handles. There is no manual intervention required. It won't kill the pause process though, so it can be a problem if someone mixes different versions and restart the pause process |
c852de4 to
fdb0407
Compare
use name_to_handle_at and open_by_handle_at to persist rootless namespaces without needing a pause process. The namespace file handles are stored in a file and can be used to rejoin the namespaces, as long as the namespaces still exist. Fall back to the pause process approach only when the kernel doesn't support nsfs handles (EOPNOTSUPP). These changes in the kernel are required (landed in Linux 6.18): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3ab378cfa793 Signed-off-by: Giuseppe Scrivano <[email protected]>
fdb0407 to
692410d
Compare
|
comments addressed |
use name_to_handle_at and open_by_handle_at to persist rootless namespaces without needing a pause process.
The namespace file handles are stored in a file and can be used to rejoin the namespaces, as long as the namespaces still exist.
Fall back to the pause process approach only when the kernel doesn't support nsfs handles (EOPNOTSUPP).
These changes in the kernel are required (landed in Linux 6.18):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3ab378cfa793
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?