[PATCH v2 31/34] ext4: use the generic emergency read-only state
Christian Brauner
brauner at kernel.org
Thu Oct 29 09:07:22 PDT 2026
Set SB_STATE_EMERGENCY_RO next to EXT4_FLAGS_EMERGENCY_RO when an error
makes the filesystem read-only. The VFS then refuses modifications
before they reach ext4 and reports the superblock as read-only like it
did when ext4 still set SB_RDONLY. The shutdown state stays ext4's own
and so do all of ext4's checks because they cover both states. ext4
keeps showing "emergency_ro" in its mount options.
Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>
---
fs/ext4/super.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ae5ba6823c01..afbdbb607b14 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -757,6 +757,7 @@ static void ext4_handle_error(struct super_block *sb, bool force_ro, int error,
* and other problems.
*/
set_bit(EXT4_FLAGS_EMERGENCY_RO, &EXT4_SB(sb)->s_ext4_flags);
+ sb_set_emergency_ro(sb);
}
static void update_super_work(struct work_struct *work)
--
2.53.0
More information about the linux-mtd
mailing list