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

Avoid remounting already mounted /run and /tmp directories #408

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

mandelmassa
Copy link

This is a patch for finit 4.8 beta 1.

It adds the function fistmpfs to determine if a new tmpfs mount should be performed on /run and /tmp. The function supports cases where more complex mount hierarchies are in use, including overlayfs backed mounts.

In our system, /tmp is a symbolic link to a subdirectory in an overlayfs mount. This means that /tmp does not explicitly show up in /proc/mounts, so in fs_finalize, finit decides to mount a new tmpfs on top of it.

This turns out to be problematic for our smallest systems where the new tmpfs on /tmp is not large enough.

I do realize this may be a bit particular to our specific setup, but the patch works on our system. Any comments are welcome.

Copy link
Owner

@troglobit troglobit left a comment

Choose a reason for hiding this comment

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

Please fix the review comment, otherwise this looks OK to me 👍

src/util.c Outdated
Comment on lines 580 to 586
struct statfs info;

statfs(dir, &info);
if (info.f_type == TMPFS_MAGIC || info.f_type == OVERLAYFS_SUPER_MAGIC)
return 1;
Copy link
Owner

Choose a reason for hiding this comment

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

Either initialize the stack variable with { 0 }, and/or check the return value of statfs(), e.g., on error return 0;

Copy link
Author

Choose a reason for hiding this comment

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

Ok! Done.

Adds the function fistmpfs to determine if a new tmpfs mount should be
performed on /run and /tmp. The function supports cases where more
complex mount hierarchies are in use, including overlayfs backed mounts.

Signed-off-by: Mathias Thore <[email protected]>
@troglobit troglobit merged commit 29bd7a5 into troglobit:master Aug 6, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants