Skip to content

Commit

Permalink
ext4: clear mmp sequence number when remounting read-only
Browse files Browse the repository at this point in the history
Previously, when an MMP-protected file system is remounted read-only,
the kmmpd thread would exit the next time it woke up (a few seconds
later), without resetting the MMP sequence number back to
EXT4_MMP_SEQ_CLEAN.

Fix this by explicitly killing the MMP thread when the file system is
remounted read-only.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Andreas Dilger <adilger@dilger.ca>
  • Loading branch information
tytso committed Jul 8, 2018
1 parent 44de022 commit 2dca60d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 2 additions & 5 deletions fs/ext4/mmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,8 @@ static int kmmpd(void *data)
goto exit_thread;
}

if (sb_rdonly(sb)) {
ext4_warning(sb, "kmmpd being stopped since filesystem "
"has been remounted as readonly.");
goto exit_thread;
}
if (sb_rdonly(sb))
break;

diff = jiffies - last_update_time;
if (diff < mmp_update_interval * HZ)
Expand Down
2 changes: 2 additions & 0 deletions fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -5212,6 +5212,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)

if (sbi->s_journal)
ext4_mark_recovery_complete(sb, es);
if (sbi->s_mmp_tsk)
kthread_stop(sbi->s_mmp_tsk);
} else {
/* Make sure we can mount this feature set readwrite */
if (ext4_has_feature_readonly(sb) ||
Expand Down

0 comments on commit 2dca60d

Please sign in to comment.