troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
634 stars 63 forks source link

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

Closed mandelmassa closed 3 months ago

mandelmassa commented 3 months ago

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.