Skip to content

Commit

Permalink
ext4: don't remount read-only with errors=continue on reboot
Browse files Browse the repository at this point in the history
ext4_handle_error() with errors=continue mount option can accidentally
remount the filesystem read-only when the system is rebooting. Fix that.

Fixes: 1dc1097 ("ext4: avoid panic during forced reboot")
Signed-off-by: Jan Kara <[email protected]>
Reviewed-by: Andreas Dilger <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Theodore Ts'o <[email protected]>
  • Loading branch information
jankara authored and tytso committed Dec 17, 2020
1 parent 46e294e commit b08070e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,19 +666,17 @@ static bool system_going_down(void)

static void ext4_handle_error(struct super_block *sb)
{
journal_t *journal = EXT4_SB(sb)->s_journal;

if (test_opt(sb, WARN_ON_ERROR))
WARN_ON_ONCE(1);

if (sb_rdonly(sb))
if (sb_rdonly(sb) || test_opt(sb, ERRORS_CONT))
return;

if (!test_opt(sb, ERRORS_CONT)) {
journal_t *journal = EXT4_SB(sb)->s_journal;

ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED);
if (journal)
jbd2_journal_abort(journal, -EIO);
}
ext4_set_mount_flag(sb, EXT4_MF_FS_ABORTED);
if (journal)
jbd2_journal_abort(journal, -EIO);
/*
* We force ERRORS_RO behavior when system is rebooting. Otherwise we
* could panic during 'reboot -f' as the underlying device got already
Expand Down

0 comments on commit b08070e

Please sign in to comment.