Thanks, Samuel. I am unable to reproduce any of these behaviors in QEMU, probably because it is much more forgiving than some of these actual hardware drivers. My host hardware is all NVMe, so it is tricky to replicate bare-metal SATA/IDE quirks.
But from what I can tell, it seems that memory misalignment in the ext2_lifeboat cache is the root of the problem. This small patch fixes the alignment and also adds a physical hardware flush to the end of the journal shutdown. Both of these should directly address the bugs you are experiencing. I have tested this heavily on my setup, but since the emulator masks the bug for me either way, I can only definitively say it doesn't cause regressions. Would you be willing to give it a spin on your i386 box? Thanks, Milos On Sun, Aug 30, 2026 at 4:13 PM Samuel Thibault <[email protected]> wrote: > Milos Nikic, le dim. 30 août 2026 16:07:58 -0700, a ecrit: > > Is there any image that is set up to run without rumpdisk (grub setup, > and > > others)? > > Note that on my own box with the corruption that I mention, I am using > rumpdisk. > > Also note that rumpdisk is mandatory in 64b execution, only 32b can > support non-rumpdisk disk drivers, and there is not much to do to > disable rumpdisk on 32b, since it's already the default. > > Samuel > > > On Sun, Aug 30, 2026 at 12:10 PM Milos Nikic <[1][email protected]> > wrote: > > > > Yeah and I am keep trying to reproduce any of that in qemu with > rumpdisk > > and not managing. > > > > I have to find a way to run those drivers because it seems to happen > only > > there. > > > > I will keep trying. > > > > On Sun, Aug 30, 2026, 11:31 AM Samuel Thibault <[2] > [email protected]> > > wrote: > > > > I keep getting corrupted files from times to times. Now my python > > interpreter is corrupted and even trying to install .deb by hand > > doesn't > > work. > > > > I'll stop trying to test it, it's too buggy for now. > > > > Samuel > > > > > > References: > > > > [1] mailto:[email protected] > > [2] mailto:[email protected] >
From b716b370243fb159f7cbe772530c64bc84826e5c Mon Sep 17 00:00:00 2001 From: Milos Nikic <[email protected]> Date: Mon, 31 Aug 2026 08:36:44 -0700 Subject: [PATCH] ext2fs: Align ext2_lifeboat cache. Force a compiler to align ext2_lifeboat cache, which helps eliminate file corruption in certain scenarios. Added additional flush to disk at the journal shutdown. --- ext2fs/journal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext2fs/journal.c b/ext2fs/journal.c index 91b8e64ff..8b03604ab 100644 --- a/ext2fs/journal.c +++ b/ext2fs/journal.c @@ -162,7 +162,7 @@ struct journal_lifeboat uint64_t alloc_mask[JRNL_LIFEBOAT_ALLOC_MASK_LEN]; /* The pre-allocated payload pool (512 * 4KB = 2MB) */ - char payloads[JRNL_LIFEBOAT_CAPACITY][4096]; + char payloads[JRNL_LIFEBOAT_CAPACITY][4096] __attribute__((aligned(4096))); }; static struct journal_lifeboat ext2_lifeboat; @@ -1459,6 +1459,7 @@ journal_quiesce_checkpoints (void) /* Clear the list and write s_start = 0 to the JBD2 superblock */ journal_clear_checkpoint_list_locked (ext2_journal); JOURNAL_UNLOCK (ext2_journal); + flush_to_disk (); } /** -- 2.55.0
