rootfs removed when opening a socket

Erik Moqvist <[email protected]>
Newsgroups org.kernel.vger.initramfs
Message-ID <CAPZf9tBFHTjnyV+fO61ppyt4cXurcnzedbgWJEsbSPb6zeKKdw@mail.gmail.com>
Hello!

I'm working on a minimal embedded system where I intend to use the
initramfs as rootfs with /init implementing the entire system. I have
no need to mount another file system as rootfs.

Yesterday I noticed that the rootfs was removed about 10 minutes after
power on. It was just gone. After a few hours of debugging I noticed
that inodes started to be evicted at the same time as the rootfs was
removed. It turned out that my application periodically opens sockets
which are never closed, and as each socket allocates an inode, the
system eventually runs out of inodes (I think) and starts evicting old
ones to be able to open another socket. Now, as I understand it, the
evicted inodes were used by the rootfs, which could explain why the
rootfs was removed.

I am a bit surprised that opening a socket can result in removing the
rootfs. Is this the intended behavior?

I'm using kernel 5.5.7 with a minimal configuration on X86_64 QEMU.
The configuration can be found here:
https://github.com/eerimoq/monolinux-example-project/blob/master/app/linux-x86_64.config

/ Erik
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.