From 6fb32a4c0351620311482bc9f42f6820bc2a00c0 Mon Sep 17 00:00:00 2001 From: Tulio A M Mendes Date: Thu, 11 Jun 2026 01:01:48 -0300 Subject: [PATCH] rootfs-handoff: implement remount,rw after filesystem verification - Implemented remount,rw after successful filesystem verification - Uses vfs_mount_full with MS_REMOUNT flag to update mount flags - Remounts filesystem read-write if it was forced read-only due to verification - If remount fails, filesystem remains read-only with warning message - This completes the 'root verification and remount,rw after checks' item from ROOTFS_HANDOFF_PLAN.md Test Results: - Smoke test: 131/131 PASS - Battery test: 157/157 PASS - Analyzer: PASS - Zero regressions --- src/kernel/init.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/kernel/init.c b/src/kernel/init.c index bfeedbb3..a2a14cc3 100644 --- a/src/kernel/init.c +++ b/src/kernel/init.c @@ -604,8 +604,16 @@ int init_start(const struct boot_info* bi) { /* Remount read-write if filesystem is clean and was forced read-only due to verification */ if (mounted && force_ro && !(mount_flags & MS_RDONLY)) { kprintf("[INIT] root=%s: filesystem verified clean, remounting read-write\n", root_dev); - /* TODO: Implement remount,rw after verification */ - /* This requires syscall support for remount with flag changes */ + /* Remount with original flags (without MS_RDONLY) */ + /* Use vfs_mount_full with MS_REMOUNT to update flags */ + int rc = vfs_mount_full("/newroot", NULL, NULL, NULL, + (mount_flags & ~MS_RDONLY) | MS_REMOUNT, + NULL, NULL); + if (rc == 0) { + kprintf("[INIT] root=%s: remounted read-write successfully\n", root_dev); + } else { + kprintf("[INIT] root=%s: remount read-write failed (%d), keeping read-only\n", root_dev, rc); + } } } else { kprintf("[INIT] root=%s: device not found\n", root_dev); -- 2.43.0