mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
libct: Enforce nr_inodes=2 to fix Focal mount errors
On most kernels `nr_inodes=1` works fine. However, Ubuntu 20.04 (Focal) with
the official 5.4 kernel carries a private patch in mm/shmem.c that rejects
"nr_inodes<2", so let's keep `nr_inodes=2` here!
Signed-off-by: lifubang <lifubang@acmcoder.com>
(cherry picked from commit feea25820e)
Signed-off-by: lifubang <lifubang@aliyun.com>
This commit is contained in:
@@ -1333,7 +1333,12 @@ func verifyDevNull(f *os.File) error {
|
||||
|
||||
// maskDir mounts a read-only tmpfs on top of the specified path.
|
||||
func maskDir(path, mountLabel string) error {
|
||||
return mount("tmpfs", path, "tmpfs", unix.MS_RDONLY, label.FormatMountLabel("nr_blocks=1,nr_inodes=1", mountLabel))
|
||||
// On most kernels `nr_inodes=1` works fine. However, Ubuntu 20.04 (Focal) with
|
||||
// the official 5.4 kernel carries a private patch in mm/shmem.c that rejects
|
||||
// "nr_inodes<2", so let's keep `nr_inodes=2` here!
|
||||
// For reference, search for "case Opt_nr_inodes" in:
|
||||
// https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal/plain/mm/shmem.c?h=Ubuntu-5.4.0-216.236
|
||||
return mount("tmpfs", path, "tmpfs", unix.MS_RDONLY, label.FormatMountLabel("nr_blocks=1,nr_inodes=2", mountLabel))
|
||||
}
|
||||
|
||||
// maskPaths masks the top of the specified paths inside a container to avoid
|
||||
|
||||
Reference in New Issue
Block a user