sfjro / aufs-standalone

27 stars 14 forks source link

tmpfs-idr.patch makes tmpfs cannot be mounted on systems with large RAM #42

Closed jamesbond3142 closed 2 months ago

jamesbond3142 commented 2 months ago

Dear Junjiro,

I have always used the optional tmpfs-idr.patch that you devised for me years ago. Recently, I thought I'd give the newer kernel a test; I'm testing 6.9.7 at the moment.

After the usual compilation, my system failed to boot at the very early init stage (still within initramfs), with a curious error message: "mount failed: no space left on device".

A few test later I know where the message came from: it's from mount -t tmpfs tmpfs /aufs/pup_init. But that's impossible to be running out of memory at that stage. I tested mount -t ramfs ramfs /aufs/pup_init and it worked. Only the tmpfs failed.

I rebooted again, and this time I specified mem=16G as the kernel parameters to limit kernel memory, and this time the boot continues ok, no error message. So it seems that reducing the memory makes the tmpfs works again.

I remember that the failure of tmps can be caused by 2 things: running out of memory, or running out of inodes. So I checked tmpfs-idr.patch, and I see that you are narrowing the size of the inode variables, from long to int:

-       unsigned long max_inodes;   /* How many inodes are allowed */
-       unsigned long free_ispace;  /* How much ispace left for allocation */
+       int max_inodes;             /* How many inodes are allowed */
+       int free_ispace;            /* How many are left for allocation */

So I thought this could be the issue.

I rebuilt the kernel without tmpfs-idr.patch, and rebooted. This time around, the system boots successfully, using the entire memory (I didn't have to use the mem= parameter anymore). That confirms that tmpfs-idr.patch is the cause of the problem.

But the funny thing, this problem doesn't happen on earlier kernels (6.1 and below, I didn't test anything newer than 6.1 yet). But it failed on 6.9, specifically 6.9.7.

Question: tmpfs-idr.patch was devised years ago to reduce the tmpfs inode keeps growing without limit (and eventually causes system crash/lockup for long-running systems). I think the problem in 6.9.7 is caused by the narrowing. So is it possible to keep the purpose of tmpfs-idr.patch, without the narrowing? Does it make sense? Or am I clueless and the problem is somewhere else?

cheers, James

sfjro commented 2 months ago

Hi,

jamesbond3142:

After the usual compilation, my system failed to boot at the very early init stage (still within initramfs), with a curious error message: "mount failed: no space left on device".

Thanks for the report. I will investigate as soon as possible, but for now I'm kinda busy.

One question, How much RAM does your system have?

J. R. Okajima

jamesbond3142 commented 2 months ago

On Fri, 5 Jul 2024, 18:55 sfjro, @.***> wrote:

Hi

Thanks for the report. I will investigate as soon as possible, but for now I'm kinda busy.

One question, How much RAM does your system have?

Thank you. There is no rush. Whenever you can. As for my system, I have 32G RAM.

J. R. Okajima

— Reply to this email directly, view it on GitHub https://github.com/sfjro/aufs-standalone/issues/42#issuecomment-2210476899, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP7NPXNVHDL34GD6VEQ2FLZKZNQNAVCNFSM6AAAAABKMRH5IKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJQGQ3TMOBZHE . You are receiving this because you authored the thread.Message ID: @.***>

sfjro commented 2 months ago

jamesbond3142:

After the usual compilation, my system failed to boot at the very early init stage (still within initramfs), with a curious error message: "mount failed: no space left on device".

I've found a commit e07c469e979c 2023-08-09 tmpfs: track free_ispace instead of free_inodes in linux-v6.6. I think the commit made aufs tmpfs-idr.patch buggy. In other words, tmpfs-idr.patch should address the commit.

I will send you a patch in another direct mail. Please test it.

J. R. Okajima

sfjro commented 2 months ago

------- Blind-Carbon-Copy

From: "J. R. Okajima" @.> To: @. Subject: aufs6 GIT release (v6.10-rc7) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: @.> Date: Mon, 15 Jul 2024 04:27:39 +0900 Message-ID: @.>

o bugfix

J. R. Okajima


------- End of Blind-Carbon-Copy

jamesbond3142 commented 2 months ago

Thank you Junjiro-san, always appreciate your help. I confirm the fix works, so closing this ticket now.